2

I need help with a strategy on how to think regarding IIS - URL rewrite - Application Request Routing.

Example

Let's say that I can access my web server from outside my wifi via http://2X0.2X1.2X2.2X3 (this is how it works today). My IIS webserver respond to a request with a web page (port 80). Fine, I understand how it works.

In a close future, I also need to to deal with external systems posting data to my node-red server instance. The node-red server instance resides on the same Windows 10 computer but it answers on another port (1880)

This is what I want to achieve:

If I make an external request to http://2X0.2X1.2X2.2X3/myHomePage/2/34/56, something (IIS?) should translate it to (inside my wifi) http://127.0.0.1:80/Index.aspx?value1=2&value2=34&value3=56

http://2X0.2X1.2X2.2X3/api/switch/turnOn/20, should translate to http://127.0.0.1:1880/switch/turnOn/20

http://2X0.2X1.2X2.2X3/api/switch/turnOff/20, should translate to http://127.0.0.1:1880/switch/turnOff/20

My question: I am pretty sure that IIS URL rewrite / Application Request Routing can help me here but I am not sure how to achieve it. How should the rules look like? Should I use URL rewrite?

Edit 1:

Im trying to depict my situation here: enter image description here

1 Answer 1

2

You can use IIS inbound rewrite rule. It will be something like this:

For myHomePage:

enter image description here

For api:

enter image description here

May be I lost the point somewhere, but I think logic is right.

p.s. Edited my answer.

5
  • Little mistake, {REQUEST_URI} shoud be will slash: /(.*) Commented Aug 3, 2018 at 4:22
  • Just one more thing. How do I deal with the situation 2X0.2X1.2X2.2X3/myHomePage vs 2X0.2X1.2X2.2X3/api? They need to be redirected to different ports inside my wifi. Commented Aug 3, 2018 at 5:20
  • I updated my question with an image @warder. Commented Aug 3, 2018 at 7:31
  • I've been trying to follow along with this, but for whatever reason the redirect to port 1880 just wont work, and IIS keeps wantign to send all requests through to port 80. Even tried usign a server variable for port, tried swapping the regex in to the pattern field, and even tried highly limiting the request to the "my HomePage" example with regex. Always with the redirect to port 80. Super frustrating. Commented May 5, 2021 at 4:42
  • 2
    I've noticed that in the Conditions list, the server variable should probably not be QUERY_STRING but PATH_INFO. Here are the most important ones.. Commented Aug 9, 2021 at 21:14

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.