简体   繁体   中英

Why is my fully qualified domain name request url getting converted to an ip address request url by the Cassini web server?

I have a web application which depends on the browser client retaining the FQDN in order for it to work, but what is happening is that in multiple browsers I am seeing the url get converted into an ip address url (containing the correct IP address) which is getting changed by a redirect from the web server.

The web server hosting the resource is Cassini, and the HttpRequest class Url property is returning the IP address in the URL instead of the FQDN.

Any suggestions on how to change this behavior?

This is probably a misconfiguration in your web server. In apache (for example), one can set the canonical host name to be used when doing certain rewrite procedures using the ServerName directive. One common one is when the web server adds slash to the end of your URL (" http://example.com/path " → " http://192.168.1.1/path/ ").

I recommend taking a peek at what's going on with curl.

This is not a DNS issue, it's a web server configuration issue.

Yes, the DNS is used to convert the hostname part of the URL into an IP address.

However that IP address will never appear in the browser bar unless the web server tells it to by sending a redirect .

Thanks to the helpful information provided, I was able to track down this issue to an incomplete implementation of the HttpWorkerRequest abstract class of the .NET Framework as part of the Cassini implementation. The Cassini implementation failed to override the GetServerName and the base implementation was returning the IP address instead of the domain name.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM