问题
I am trying to get one (public) server A to act as a reverse proxy for another (private) server B. Server B is visible to server A. i.e. if I'm on server A and I type in a browser:
https://serverb.us/folder/application
I see the application. I want it so that if the user types:
https://servera.us/folder/application
he sees the web application that is on server B. Is that possible?
I have tried adding a rewrite rule in IIS Manager by doing
URL Rewrite > Add Rule(s) > Reverse Proxy >
I changed inbound rule to exact match: https://servera.us/folder/application (ignore case)
Rewrite URL: https://serverb.us/folder/application (uncheck append query string)
but it doesn't do anything. Am I missing something?
回答1:
According to your description, I suggest you could try to use below url rewrite rule:
<rewrite>
<rules>
<rule name="Reverse Proxy to b" stopProcessing="true">
<match url="^folder/application/(.*)" />
<action type="Rewrite" url="https://serverb.us/folder/application/{R:1}" />
</rule>
<rewrite>
回答2:
The problem turned out to be Authentication. I had to make sure both applications had the same Authentication settings in IIS Manager (click on the web app or folder in IIS Manager then double-click Authentication)
来源:https://stackoverflow.com/questions/54408113/iis-8-5-how-to-set-up-reverse-proxy-with-url-rewrite