Norman H
Norman H

Reputation: 2262

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?

Upvotes: 0

Views: 3137

Answers (3)

Norman H
Norman H

Reputation: 2262

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.

Upvotes: 1

Alnitak
Alnitak

Reputation: 339965

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.

Upvotes: 1

Steve Pomeroy
Steve Pomeroy

Reputation: 10129

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.

Upvotes: 2

Related Questions