简体   繁体   中英

IIS 8.5 How to set up reverse proxy with URL Rewrite

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. ie 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?

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>

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM