I have a Sitecore 9.3 xp1 scaled application hosted in Azure PaaS. The CD App Service sits behind an F5 and Azure Gateway, with DNS of https://mysite.com routing through these 2 proxies (F5 -> Gateway -> App Service). The App Service itself is hosted at https://mysite.azurewebsites.net.
I have configured my site's targetHostName attribute to be mysite.com accordingly. I have also instructed the Media Manager and Link Manager to include server URL when generating links.
Problem: Whenever a Link or Image URL is generated by Sitecore, the URL always includes https://mysite.azurewebsites.net as the hostname.
I have debugged the HttpContext.Current.Request and found these values being set:
{
"Headers": {
"Host": "mysite.azurewebsites.net",
"Max-Forwards": "9",
"X-Forwarded-For": "<ip address list>",
"X-FORWARDED-PROTO": "https",
"X-FORWARDED-PORT": "443",
"X-ORIGINAL-HOST": "mysite.com",
"X-Original-URL": "/some/local/path",
"DISGUISED-HOST": "mysite.azurewebsites.net",
"WAS-DEFAULT-HOSTNAME": "mysite.azurewebsites.net",
"X-AppService-Proto": "https"
},
"HttpMethod": "GET",
"IsSecureConnection": true,
"Url": "https://mysite.azurewebsites.net/some/local/path",
"UrlReferrer": null,
"RawUrl": "/some/local/path"
}
I believe Sitecore is generating URLs based on the HttpContext.Current.Url or the Host header. Without Hijacking and modifying the Link/Media managers, how do I get the URLs to come out according to the X-ORIGINAL-HOST header?
targetHostName
is set to mysite.com accordingly.