Virtual hosting is a http feature that allows:
In other term, this functionality permits to host several website on the same computer.
The algorithm (as explained in section 5.2) is:
- otherwise, the host value is the value of the host header
and if the host is not a valid host on the server, the response MUST be a 400 (Bad Request) error message.
The implementation / configuration takes place
If you're server is running behind a proxy, the host header will be the hostname of the proxy, if the request uri is not qualified , you should therefore use the X-Forwarded-Host header to determine how to handle requests.
SSL and Certificate
When using SSL, the SSL connection is established before the browser sends an HTTP request, the name of the requested server is then not known (and generally the default server’s certificate is served).
To resolve this problem and serve the appropriate certificate, several solutions can be used:
|Assign a separate IP address for every HTTPS server||The oldest and most robust method but not easy to implement for dynamic custom domain|
|Lookup the name in the SSL Server Name Indication property|
|Use only one domain validated certificate with several name in the Subject Alternative Name (SubjectAltName) field (ie www.example.com and www.example.org)||The SubjectAltName field length is limited|
|Use a wildcard certificate (for example, *.example.org)|
Web Server / Proxy
If you host your server your self, you need to configure your webserver virtual host features.
Example: Apache - Virtual Host (Vhost)