views:

614

answers:

3

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?

+2  A: 

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.

Steve Pomeroy
+1  A: 

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.

Alnitak
+1  A: 

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.

Norman H