Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I allow trailing dot in host headers in IIS

Tags:

url

iis

dns

I am running an IIS 7.5 site that serves up content for http://www.foo.com/

I've been asked to properly route http://www.foo.com./ (note the trailing dot). If you hit that page now, you'll get an IIS error:

Bad Request - Invalid Hostname

HTTP Error 400. The request hostname is invalid.

This happens even for http://www.microsoft.com. I have seen some sites route trailing periods successfully (like http://www.amazon.com./), but it looks like most of those were using Apache, not IIS.

I added a host header in IIS for www.foo.com. which is allowed. However, it won't let you start the site. It won't start and pops up a message box saying:

Value does not fall within the expected range.

Does anyone know how to serve up domains with trailing dots in IIS?

like image 553
Aaron D Avatar asked Jul 22 '10 22:07

Aaron D


People also ask

How do I host a header in IIS?

Setting Up Host Headers in IIS 7 Using the Command LineInstall the SSL Certificate to the site where you will use secure bindings. Next, open a command line by clicking Start > Run. Type cmd and click OK. Type cd C:\Windows\System32\Inetsrv\ to change the directory where you manage SSL host headers and click enter.

What are IIS host headers?

Host headers are used in IIS to direct web requests to different hostnames using the same IP address and port, to configure host headers within IIS, please follow the below steps.

How do host headers work?

The host header specifies which website or web application should process an incoming HTTP request. The web server uses the value of this header to dispatch the request to the specified website or web application. Each web application hosted on the same IP address is commonly referred to as a virtual host.

What is host header name?

Introduced in HTTP 1.1, a host header is a third piece of information that you can use in addition to the IP address and port number to uniquely identify a Web domain or, as Microsoft calls it, an application server. For example, the host header name for the URL http://www.ideva.com is www.ideva.com.


2 Answers

The trailing dot is an absolutely legal part of the hostname - it's just that it's normally invisible because it's implicit in DNS. If the trailing dot is present it's called a "Fully Qualified" Domain Name (FQDN).

Note that on the wire DNS always deals in FQDNs.

§3.2.2 of RFC 3976 (the definition for URI syntax) says this (my emphasis):

A host identified by a registered name is a sequence of characters usually intended for lookup within a locally defined host or service name registry, though the URI's scheme-specific semantics may require that a specific registry (or fixed name table) be used instead. The most common name registry mechanism is the Domain Name System (DNS). A registered name intended for lookup in the DNS uses the syntax defined in Section 3.5 of [RFC1034] and Section 2.1 of [RFC1123]. Such a name consists of a sequence of domain labels separated by ".", each domain label starting and ending with an alphanumeric character and possibly also containing "-" characters. The rightmost domain label of a fully qualified domain name in DNS may be followed by a single "." and should be if it is necessary to distinguish between the complete domain name and some local domain.

File a bug report with MS.

like image 72
Alnitak Avatar answered Nov 07 '22 16:11

Alnitak


This is effectively a bug in IIS7+, apparently with no workarounds. It is affecting me as well. Please go vote up the request for MS to fix this:

https://connect.microsoft.com/WindowsServerFeedback/feedback/details/648242/trailing-dot-in-fqdn-causing-bad-request-invalid-hostname

like image 44
Brady Moritz Avatar answered Nov 07 '22 16:11

Brady Moritz