We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

Reverse-proxy to different backend base on request FQDN [Answered]RSS

4 replies

Last post May 28, 2019 12:16 PM by Gabriele Rusconi

  • Reverse-proxy to different backend base on request FQDN

    May 27, 2019 02:16 PM|Gabriele Rusconi|LINK

    We have a MS IIS NLB resolved by DNS with two different FQDNs, for example:

    https://app1.domain.org
    https://app2.domain.org

    We have to proxy "app1.domain.org" to an backend application server (e.g. http://appA.domain.intra) and "app2.domain.org" to a different backend application server (e.g. http://appB.domain.intra).

    Is is possibile? May you help to write the Rewrite Rule based on request FQDN?

    KR,

    Gabriele

  • Re: Reverse-proxy to different backend base on request FQDN

    May 27, 2019 02:31 PM|lextm|LINK

    Lex Li
    Want to have a chat on the issues you meet? Book an appointment at https://buy.stripe.com/cN24ia0yi7sAdIA7sv
    ---------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Reverse-proxy to different backend base on request FQDN

    May 27, 2019 02:44 PM|Gabriele Rusconi|LINK

    lextm

    Typical reverse proxy setup,

    https://docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/reverse-proxy-with-url-rewrite-v2-and-application-request-routing 

    Hi lectm,

    thanks for the link but in that case the domain name is the same (http://contoso.com) and the variable is the path (/webmail and /payroll).

    In my case, the domain name is different (appONE.main.org and appTWO.domain.org) as well as the paths.

  • Re: Reverse-proxy to different backend base on request FQDN

    May 27, 2019 06:53 PM|lextm|LINK

    Reverse proxy rules can use conditions to assert host headers of incoming requests, so your scenario can still be covered. Just some tiny modification.

    Lex Li
    Want to have a chat on the issues you meet? Book an appointment at https://buy.stripe.com/cN24ia0yi7sAdIA7sv
    ---------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Reverse-proxy to different backend base on request FQDN

    May 28, 2019 12:16 PM|Gabriele Rusconi|LINK

    Thanks lextm for the hint, following my solution:

    URL Rewrite

    Inbound Rule
    Name: mydashboard.nexive.it
    Match URL
    Requested URL: Matches the Pattern
    Using: regualr Expressions
    Pattern: .*
    Ignore case: YES
    Conditions
    Logical grouping: Match Any
    [Add]
    Condition input: {HTTP_HOST}
    Check if input string: Matches the Pattern
    Pattern: APP1.domain.com
    Ignore case: YES
    [OK]
    Action
    Action type: Route to Server Farm
    Scheme: (PoC) http:// (Prod) ??? https://
    Server farm: ...
    Path: /{REQUEST_URI}
    Stop processing of subsequent rules: YES