TransWikia.com

Sitecore Item URL with Custom Domain in Azure PaaS

Sitecore Asked by Alok Kumar on August 23, 2021

I have Sitecore 8.2 update 5 site deployed in Azure PaaS as an App Service. I have created a custom domain (e.g. abc.com) in the App Service. This custom domain is kept behind F5 firewall. I am facing the problem with the item URLs, linkManager.GetItemUrl method is returning URL with App Service URL ( e.g. https://appservicename.azurewebsites.net/pagename) and not with the custom domain.

Please let me know how can i get the correct URL with custom domain name i.e. https://abc.com/pagename.

Thanks,
Alok…

2 Answers

This is probably similar to this question: Incorrect URLs when behind proxy

If you're terminating your request at the F5 and allowing the F5 to make the request directly to the *.azurewebsites.net URL, Sitecore is going to resolve the site with the *.azurewebsites.net URL and subsequently any links generated will be with that hostname. To remedy this, you'll need to use rewrite rules to rewrite the host header with the value of the header of the original request forwarded by the F5 which I believe is the X-FORWARDED-FOR header. There are a few quirks to rewriting the headers on an App Service and you can find more details about it from the below post. Even though this post covers Azure Application Gateway instead of an F5, the concept is the same and you'll need to perform similar steps to rewrite the host header.

https://georgechang.io/posts/2020/sitecore-multisite-support-with-azure-application-gateway-and-app-services/

Answered by George Chang on August 23, 2021

You should set the custom domain as targetHostName if you want that in the urls.

The targetHostName is the host name to use when generating URLs to items within this site from the context of another site. If the targetHostName attribute is absent, Sitecore uses the value of the hostName attribute instead. Used only when the value of the Rendering.SiteResolving setting is true.

https://ericastockwellalpert.wordpress.com/2018/03/26/sitecore-link-resolving-multisites-hostname-pipes-and-target-hostname/

It could be that your firewall is not sending the original domain - you could change that or fix it with the targethostname property.

Answered by Gatogordo on August 23, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP