Skip to content

Not handling X-Forwarded-Host header during custom authentication redirection #558

Description

Describe the bug

If you set up Front Door (or L7 Reverse proxy) in front of Static Web App and add Azure AD or OpenID Connect authentication after adding a custom domain to Front Door, the redirection will not be done on the custom domain.

It looks to me like a common problem of not handling X-Forwarded-Host correctly.

image

This can be handled by setting forwardProxy in httpSettings for Easy Auth in the App Service, but cannot be avoided in Static Web Apps because the setting is not provided.

https://docs.microsoft.com/en-us/azure/templates/microsoft.web/sites/config-authsettingsv2?tabs=json#httpsettings-object

To Reproduce
Steps to reproduce the behavior:

  1. Create Static Web App
  2. Create a Front Door and add Static Web App as a backend
  3. Add custom domain to Front Door
  4. Setup SWA custom authentication for custom domain
  5. Access to https://customdomain/.auth/login/***

Expected behavior

The custom domain being accessed (the custom domain set in Front Door) is maintained even when redirected to the IdP.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions