Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • MB JF 3 posts 74 karma points
    Sep 04, 2018 @ 14:18
    MB JF
    0

    Multiple sites/nodes - using x-forwarded-host

    I am currently trying to setup an umbraco site.

    The umbraco installation is hosting multiple sites and the different nodes are selected by subdomain e.g: sub1.mysite.com, sub2.mysite.com.

    Now the difficult part is that the security system around the umbraco installation will strip the header completely, leaving only an internally known host in the head, but the original host will be available in "x-forwarded-host".

    Is there any way to make umbraco select different nodes based on "x-forwarded-host"?

  • Dale McCutcheon 32 posts 135 karma points
    Aug 27, 2019 @ 16:22
    Dale McCutcheon
    0

    Hi MB JF,

    Did you ever get a solution working for this? We are experiencing the same issue at the moment.

    Cheers Dale

  • MB JF 3 posts 74 karma points
    Aug 27, 2019 @ 17:28
    MB JF
    0

    Hi Dale

    Yes and no.

    No being that I was not able to find any way to make Umbraco react to another header, other than “host”.

    What I did was I added an ARR to the infrastructure do some header switching.

    The are take the X-Forwarded-Host header and placed the value in the HOST header and sent the request to the IIS.

  • Marcin Zajkowski 112 posts 585 karma points MVP 6x c-trib
    Sep 11, 2020 @ 09:34
    Marcin Zajkowski
    0

    What's "ARR" in your setup?

    Facing the same issue now. I'm considering HOST header replacement, but now discussing if we should do it on the Gateway level or within the app.

    Any suggestions from the previous experience?

  • Dale McCutcheon 32 posts 135 karma points
    Sep 11, 2020 @ 13:33
    Dale McCutcheon
    1

    We ended up having a rewrite rule which replaces the HOST with the X-FORWARDED-HOST header within the web config.

    Please note this means there needs to be an applicationHost.xdt file added to the Kudu console if you are using azure app services in order to expost the x-forwarded-host header.

    Cheers Dale

  • Marcin Zajkowski 112 posts 585 karma points MVP 6x c-trib
    Sep 13, 2020 @ 23:49
    Marcin Zajkowski
    0

    You mean "X-ORIGINAL-HOST"? It's set for me by default, when X-FORWARDED-HOST seems to be empty without adding it manually at the gateway level. If so... that's exactly what I'm doing now.

    Following the instructions from:

    I've improved the process by installing/enabling the Kudu/AppService extensions via DevOps pipeline, so I don't need to do anything manually on any environment to make it work.

    Seems like it's all working fine now, so I'm continuing testing and documenting the output. Cheers!

  • MB JF 3 posts 74 karma points
    Sep 14, 2020 @ 07:04
    MB JF
    1

    Hello

    ARR is an IIS module (https://www.iis.net/downloads/microsoft/application-request-routing)

    What we did was: Request was received on a internal security system, at this point, the "host" header was placed in the "X-Forwarded-Host" header.

    The request was then directed to the ARR where we made a rule to replace the, now changed, "Host" with whatever was in the "X-Forwarded-Host", if it was not empty.

    The rules in the ARR is made the same way as URL Rewrite rules.

    I am not sure this answers your question, but that is how I resolved this problem.

  • Marcin Zajkowski 112 posts 585 karma points MVP 6x c-trib
    Sep 15, 2020 @ 08:44
    Marcin Zajkowski
    0

    Thanks for sharing. As usual, there is more than one way of resolving the issue. Glad we both find the solutions! Cheers.

Please Sign in or register to post replies

Write your reply to:

Draft