question

CathinkaWalberg-9811 avatar image
0 Votes"
CathinkaWalberg-9811 asked ·

Redirecting problems and custom domain in App service behind Cloudfront

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-webappsazure-webapps-custom-domains
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

CathinkaWalberg-9811 avatar image
0 Votes"
CathinkaWalberg-9811 answered ·

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://docs.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-custom-domain#enable-the-cname-record-mapping-in-azure

· Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.