IIS 8.5 How to set up reverse proxy with URL Rewrite

孤街浪徒 提交于 2019-12-13 03:43:06

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!