Where is the origin of HttpContext.Current.Request.Url.Host?
HttpContext.Current.Request.Url.Host
is the host header content that the ASP.net application receives. (see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html for more information on HTTP headers like Host
).
Typically, the header that ASP.NET sees is identical to the header Host
sent by the browser. However, they may not match if there is software or hardware between the browser and your ASP.net code and rewriting the header Host
.
For example, large-scale budget hosters like GoDaddy do this so they can support multiple top-level domains on a single IIS website even on their cheaper hosting plans. Rather than creating a separate IIS website (which adds server load and therefore cost), GoDaddy redirects requests to http://secondsite.com/ into a virtual directory on your "main" site, such as http: // firstsite.com/secondsite ). They will change both the Host: header and the URL.
By the way, you can easily verify that this happens by dumping the content of the HTTP request headers that your application receives.
Anyway, if you want to figure out who is changing the Host header, start with the people who host your web application (or the team that is in charge of your load balancer and / or reverse proxy), as they are probably the ones who are in charge. for rewriting your host header.
a source to share