IIS 8.5 How to set up reverse proxy with URL Rewri

2019-08-17 08:12发布

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?

2条回答
该账号已被封号
2楼-- · 2019-08-17 09:04

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)

查看更多
倾城 Initia
3楼-- · 2019-08-17 09:10

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>
查看更多
登录 后发表回答