Forum

VirtualHost and multiple hostnames

Stan
10 June 2014, 23:54
As suggested, I configure the default host with server ip, and a blank start page.
Hostname = xx.xx.xx.xx
WebsiteRoot = /var/www/hiawatha
StartFile = index.html
AccessLogfile = /var/log/hiawatha/access.log
ErrorLogfile = /var/log/hiawatha/error.log

Then, a virtual host.
VirtualHost {
Hostname = censored.com, www.censored.com
WebsiteRoot = /data/www/censored.com
AllowDotFiles = no
AccessLogFile = /var/log/hiawatha/censored.com/access.log
ErrorLogFile = /var/log/hiawatha/censored.com/error.log
UserWebsites = no
#UseFastCGI =
#UseToolKit =
}

When requesting "http://censored.com", works as expected.
When requesting "http://www.censored.com", I get a blank page. Not expected.
When requesting "http://censored.com/somedir", works as expected.
When requesting "http://www.censored.com/somedir", works as expected.


Hiawatha version: 9.6
Operating System: Debian Wheezy (amd64)
Hugo Leisink
11 June 2014, 07:07
Both censored.com and www.censored.com resolve to the same IP address? Correct that no CGI is involved? Only static HTML and other files?
Stan
11 June 2014, 08:33
Yes same ip.
No cgi.
Only html.
Stan
11 June 2014, 08:36
Yes same ip.
No cgi.
Only html.
Stan
11 June 2014, 16:24
Not a bug. It is working now, although several hours after server restart...

Thanks Hugo for an amazing software.
Hugo Leisink
11 June 2014, 16:50
You forgot a server restart after config change?
Stan
11 June 2014, 18:51
No. I did properly restart the server.
Stan
11 June 2014, 19:18
I can, however, perfectly reproduce the "bug".

Note that I am using the amd64 package from http://files.tuxhelp.org/hiawatha/

a) remove "www.censored.com" from the Hostname line in VirtualHost; restart the server with "/etc/init.d/hiawatha restart"; request "http://www.censored.com"; get a blank page, that is expected.
b) add "www.censored.com" to the Hostname line in VirtualHost; restart the server; get a blank page from "http://www.censored.com"... not expected.

My guess now is that it will work fine -- but tomorrow morning.

I don't know how to interpret that as a Hiawatha bug, OS problem, or problem with the Debian package.
Hugo Leisink
11 June 2014, 19:32
Can you tell me the real hostname (assuming www.censored.com is fake), so I can see for myself. Does the following work?
Hostname = www.censored.com, *.censored.com
Stan
11 June 2014, 20:00
Trying with "Hostname = www.censored.com, *.censored.com":
I get a blank page requesting "http://www.censored.com". I get my website requesting "http://censored.com". I had seen those inconsitencies before, but I only told you the most obvious.

I then tried from my phone's browser; and it was ok at first. After another config change, things start to get strange again. Same happened at my neighbour's, who is running a old mac.

Website is astrorigin dot ch
Hugo Leisink
11 June 2014, 20:02
I see your site with both www and without www.
Stan
11 June 2014, 20:36
I do not. Then I refresh and get "Request Timeout" error. Then I refresh and I do see both, too.
On my phone one is working, not the other (code 304).

Hugo Leisink
11 June 2014, 20:39
Try telnetting to port 80 of your server and use
GET / HTTP/1.0
Host: www.astrorigin.ch


and again with
GET / HTTP/1.0
Host: astrorigin.ch


You'll see that both show you the website. You don't have a webserver issue, but a browser issue. Bad proxy maybe?
Stan
11 June 2014, 20:44
Definetly not a bug in Hiawatha.
Stan
11 June 2014, 21:11
No proxy. And system log shows a lot of "Timeout while waiting for first requests" recently.

Thanks for your support.
This topic has been closed.