Third party reverse proxy with Azure Front Door to an App Service header issues

Scot Forsyth 0 Reputation points
2024-08-01T17:25:29.25+00:00

I have an existing setup where we have an App Service (contoso.azurewebsites.net) which has multiple custom domains as it is multi-tenanted (clientA.contoso.com, clientB.contoso.com). Some clients are fine with our domain but others reverse proxy (e.g. example.clientB.com reverse proxies to clientB.contoso.com). We use the headers to determine which client and which config/styles to load. This all works fine on either approach for clients.

We are exploring using Front Door for DR and load balancing and it works fine for non-reverse proxy clients however we're facing issues with supporting the reverse proxy clients.

Our client doesn't wish our URL to be accessible directly, only under reverse proxy which they control so we rely on the host header they pass through to detect and limit this (e.g. as per example above we deny direct traffic to clientB.contoso.com if not accompanied by an example.clientB.com host header)

This worked fine on App Services but with Front Door in-between it overwrites all relevant headers and we lose visibility of the reverse proxy host (and therefore the ability to deny direct traffic via our own domain not fed-through our client's reverse proxy)

Is there any mechanism in Front Door to detect/pass through values (even if they have to be written to new headers via rules) originating from the reverse proxy? So far the rules I have tried seem to only have executed after Front Door has already overwritten values coming from the reverse proxy...

To summarise:

(Client owned) Reverse Proxy (abc.com) ----> Azure Front Door (xyz.com) -----> App Service (*.azurewebsites.net)

By the time the code in App Service runs we don't know the request is originally coming from abc.com

Tried setting origin headers, rules, etc but nothing seems to expose it

Azure Front Door
Azure Front Door
An Azure service that provides a cloud content delivery network with threat protection.
851 questions
{count} votes

1 answer

Sort by: Most helpful
  1. KapilAnanth-MSFT 49,536 Reputation points Microsoft Employee Moderator
    2024-08-02T05:21:02.7133333+00:00

    @Scot Forsyth ,

    Welcome to the Microsoft Q&A Platform. Thank you for reaching out & I hope you are doing well.

    I am afraid I did not get the requirement.

    From your verbatim,

    • You are planning to use 2 reverse proxies (client owned third party and then AFD)
    • The AppService has custom domains, say, clientA.contoso.com
    • The third party reverse proxy has example.clientB.com as the domain

    Analysis,

    • If you plan to use AFD, you have to add the custom domain to the AFD
      • So AFD's domain would also become clientA.contoso.com (same as AppService's custom domain)
    • While the above step is not necessary, it is highly recommended
    • The 3rd party reverse proxy uses a domain, say "abc.com"
      • This would try to access the AFD via clientA.contoso.com
      • The host header would be "clientA.contoso.com"

    Now,

    • This is what would an ideal setup look like
    • If my understanding is correct, you want the App Service to be only accessible via the 3rd party reverse proxy' domain - i.e., "abc.com"
    • Let me know if my understanding is incorrect

    Next steps,

    • Azure Front Door includes headers for an incoming request unless they're removed because of restrictions.
    • So whatever headers sent by the 3rd party reverse proxy is preserved and sent to the backend (App Service)
      • You should be able to use the header value in your App Service.
    • NOTE : AFAIK, the 3rd party reverse proxy would use the host header as "clientA.contoso.com" only
      • So, you can use this header to identify where the request came from in your App Service.

    Hope this clarifies

    Cheers,

    Kapil


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.