简体   繁体   中英

Pass subdomain using IIS Url rewrite and ARR

I'm using a reverse proxy setup with AAR 3 and URL Rewrite 2.0 to change domains as follow:

App.mydomain.com/ -> localhost:8000/ Usersubdomain.mydomain.com -> localhost:8000/

Based on the subdomain I need to apply special behavior to the site (custom branding, show hide features, etc)

Using AAR/URL Rewrite can I pass the original url or original subdomain to the localhost server via query string or header?

App.mydomain.com -> localhost:8000?originalurl=app.mydomain.com

You can match any domain in a rule condition and reference that in the action. In below rule {C:0} matches the domain:

<rule name="Pass domain" stopProcessing="true">
    <match url=".*" />
    <conditions trackAllCaptures="false">
        <add input="{HTTP_HOST}" pattern=".*" />
    </conditions>
    <action type="Redirect" url="http://localhost:8000?originalurl={C:0}" />
</rule>

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