Redirecting problems and custom domain in App service behind Cloudfront

Cathinka Walberg 96 Reputation points
2020-01-16T15:27:57.283+00:00

Hi,

We recently changed from on premise hosting to Azure for our Episerver site, and are experiencing problems with redirects within our site. The solutions keeps redirecting to the x.azurewebsites.net url instead of the custom domain, and we are bit lost as to what we have done wrong with the configuration of our site in Azure.

Our site consits of two solutions: the Episerver site and another solution. All urls appart from /other-solution redirects to our Episerver which runs as an app service. Because of performance issues in the other solution (and our previous on premise hosting) we have CloudFront. This means that request to our custom domain are sent to CloudFront, which then routes the traffic to the correct solution.
We are now however experiencing issues with redirects in our Episerver solution, as redirects in code sends our users to x.azurewebsites.net url instead of the custom domain.

The custom domain is not set up in Azure and we are not redirecting the host header from CloudFront. This worked at first when we moved the hosting to Azure, but the problems seams to have started happening after a big update where we amongst others updated to .Net Framework 4.7.2 from 4.6.1 and also updated Episerver from 11.11.2 to 11.14.0.

Does anyone have any idea about what we have done wrong?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,372 questions
0 comments No comments
{count} votes

Accepted answer
  1. Cathinka Walberg 96 Reputation points
    2020-01-17T14:09:11.713+00:00

    What looks to have solved the issue for us is whitelisting the host header in Cloudfront and adding our custom domain to Azure. To be able to do the latter we also had to add it in out DNS as a TXT record.

    We based our solution on, amonst others, these pages:

    https://stackoverflow.com/questions/47510478/add-custom-domain-to-azure-web-app-without-validation/55908039#55908039

    https://aws.amazon.com/premiumsupport/knowledge-center/configure-cloudfront-to-forward-headers/

    https://learn.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-custom-domain#enable-the-cname-record-mapping-in-azure

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. SYNGOUROGLOU Georgios 0 Reputation points
    2023-02-21T10:39:51.0133333+00:00

    We faced a similar problem which was fixed when we added a front slash at the end of our links. An example below.

    # This was redirecting visitors to the *.azurewebsites.net domain of our resource
    https://our.custom.domain/url/path
    
    # This wasn't
    https://our.custom.domain/url/path/
    
    0 comments No comments