Forum

Cannot access website behind Hiawatha reverse-proxy

Fred
20 July 2015, 13:27
Hello,
I have 1 Hiawatha web server running as a reverse-proxy with the following config:
set LOCALHOST = 127.0.0.0/8
set MyIPv4 = 210.85.20.10
set TrustedIP_1 = 89.115.142.33
set TrustedIP_2 = 223.147.129.244
set TrustedIP_3 = 194.127.274.42

# GENERAL SETTINGS
ServerString = Hiawatha
ServerId = www:fredadmin
ConnectionsTotal = 4096 # Maximum number of simultaneous connections. Default = 100
ConnectionsPerIP = 32 # Maximum number of simultaneous connections per IP address. Default = 10
SystemLogfile = /var/log/hiawatha/system.log
GarbageLogfile = /var/log/hiawatha/garbage.log
ThreadKillRate = 10
CacheSize = 8 # Size of Hiawatha's internal file cache. Maximum is 1024 (megabytes). Default = 10
CacheMaxFilesize = 512 # Maximum size of a file Hiawatha will store in its internal cache. Default = 256
MaxUrlLength = 1000
MinSSLversion = TLS1.2
DHsize = 4096 # Set the size of the Diffie-Hellman key. Default = 2048
SocketSendTimeout = 30
LogfileMask = deny LOCALHOST, deny MyIPv4, deny TrustedIP_1, deny TrustedIP_2, deny TrustedIP_3
RequestLimitMask = deny LOCALHOST, deny MyIPv4, deny TrustedIP_1, deny TrustedIP_2, deny TrustedIP_3

# BINDING SETTINGS
# A binding is where a client can connect to.
#
include bindings.conf

# BANNING SETTINGS
# Deny service to clients who misbehave.
#
BanOnGarbage = 300
BanOnInvalidURL = 60
BanOnMaxPerIP = 15
BanOnMaxReqSize = 300
BanOnWrongPassword = 6:900
BanOnSQLi = 3600
KickOnBan = yes
RebanDuringBan = yes
BanlistMask = deny LOCALHOST, deny MyIPv4, deny TrustedIP_1, deny TrustedIP_2, deny TrustedIP_3
ChallengeClient = 768, javascript, 15

# COMMON GATEWAY INTERFACE (CGI) SETTINGS
#
FastCGIserver {
FastCGIid = PHP5-FPM
ConnectTo = /var/run/php-fpm.sock
Extension = php
}

# URL TOOLKIT
#
include toolkit.conf

# DEFAULT WEBSITE
#
Hostname = MyIPv4
WebsiteRoot = /usr/local/www/webs/default/httpdocs
StartFile = index.html
AccessLogfile = /var/log/hiawatha/default.access.log
ErrorLogfile = /var/log/hiawatha/default.error.log

VirtualHost {
Hostname = mydomain.com www.mydomain.com
ReverseProxy .* http://210.85.20.11/
AccessLogfile = /usr/local/www/webs/development/logs/mydomain.access.log
ErrorLogfile = /usr/local/www/webs/development/logs/mydomain.error.log
}

and I have another web server (210.85.20.11) mentioned on the file above running with the following config:
set LOCALHOST = 127.0.0.0/8
set MyIPv4 = 210.85.20.11
set TrustedIP_1 = 89.115.142.33
set TrustedIP_2 = 223.147.129.244
set TrustedIP_3 = 194.127.274.42

# GENERAL SETTINGS
ServerString = Hiawatha
ServerId = www:fredadmin
ConnectionsTotal = 4096 # Maximum number of simultaneous connections. Default = 100
ConnectionsPerIP = 32 # Maximum number of simultaneous connections per IP address. Default = 10
SystemLogfile = /var/log/hiawatha/system.log
GarbageLogfile = /var/log/hiawatha/garbage.log
ThreadKillRate = 10
CacheSize = 8 # Size of Hiawatha's internal file cache. Maximum is 1024 (megabytes). Default = 10
CacheMaxFilesize = 512 # Maximum size of a file Hiawatha will store in its internal cache. Default = 256
MaxUrlLength = 1000
MinSSLversion = TLS1.2
DHsize = 4096 # Set the size of the Diffie-Hellman key. Default = 2048
SocketSendTimeout = 30
LogfileMask = deny LOCALHOST, deny MyIPv4, deny TrustedIP_1, deny TrustedIP_2, deny TrustedIP_3
RequestLimitMask = deny LOCALHOST, deny MyIPv4, deny TrustedIP_1, deny TrustedIP_2, deny TrustedIP_3

# BINDING SETTINGS
# A binding is where a client can connect to.
#
include bindings.conf

# BANNING SETTINGS
# Deny service to clients who misbehave.
#
BanOnGarbage = 300
BanOnInvalidURL = 60
BanOnMaxPerIP = 15
BanOnMaxReqSize = 300
BanOnWrongPassword = 6:900
BanOnSQLi = 3600
KickOnBan = yes
RebanDuringBan = yes
BanlistMask = deny LOCALHOST, deny MyIPv4, deny TrustedIP_1, deny TrustedIP_2, deny TrustedIP_3
ChallengeClient = 768, javascript, 15

# COMMON GATEWAY INTERFACE (CGI) SETTINGS
#
FastCGIserver {
FastCGIid = PHP5-FPM
ConnectTo = /var/run/php-fpm.sock
Extension = php
}

# URL TOOLKIT
#
include toolkit.conf

# DEFAULT WEBSITE
#
Hostname = MyIPv4
WebsiteRoot = /usr/local/www/webs/default/httpdocs
StartFile = index.html
AccessLogfile = /var/log/hiawatha/default.access.log
ErrorLogfile = /var/log/hiawatha/default.error.log
VirtualHost {
Hostname = mydomain.com, www.mydomain.com
WebsiteRoot = /usr/local/www/webs/trinitech_co_uk/development/httpdocs
StartFile = index.php
AccessLogfile = /usr/local/www/webs/development/logs/default.access.log
ErrorLogfile = /usr/local/www/webs/development/logs/default.error.log
TimeForCGI = 15
UseFastCGI = PHP5-FPM
UseToolkit = wp-multi-subdir
DenyBody = ^.*%3Cscript.*%3C%2Fscript%3E.*$
ExecuteCGI = yes
PreventCSRF = yes
PreventSQLi = yes
PreventXSS = yes
}


The problem that I have is that when i go to www.mydomain.com, it server me the content of the default website as if the VirtualHost didn't exist..

Could you please help to troubleshoot this problem?

Thank you
Hugo Leisink
20 July 2015, 13:37
I see an error in the configuration of the reverse proxy.
Hostname = mydomain.com www.mydomain.com

should be
Hostname = mydomain.com, www.mydomain.com

A comma is missing.
Fred
20 July 2015, 13:56
Thank you Hugo,
I fixed the comma and everything started to work:)
Hugo Leisink
20 July 2015, 13:59
Good to hear. I've had these kind of bugs in my code myself many times. After a long evening of hard coding, I can't find those clear but small typos. Even when I stare at them directly. And the next morning, when I'm fully rested, I spot them in a few seconds. Very frustrating.
Fred
20 July 2015, 21:29
Hugo,

Can you spot anything else in my config that could cause the following error?
Gateway Timeout
504
Hugo Leisink
21 July 2015, 08:18
No, don't see anything weird. What does the logfile say? Network connectivity issue?
Fred
21 July 2015, 11:06
Hi hugo,

The logs aren't really helping here.
The log from the proxy is:
root@zion:/var/log/hiawatha # more mydomain.comProxy.error.log
Tue 21 Jul 2015 09:47:29 +0100|Reverse proxy timeout for 210.85.20.11
Tue 21 Jul 2015 09:47:37 +0100|Reverse proxy timeout for 210.85.20.11

Here is the log form the website
root@mydomain.com:/usr/local/www/webs/production/logs # more bollenbergLIVE.error.log
10.8.20.11|Tue 21 Jul 2015 09:56:20 +0100|/www/webs/production/httpdocs/index.php|CGI returned 500 Internal Error
10.8.20.11|Tue 21 Jul 2015 09:56:33 +0100|/www/webs/production/httpdocs/index.php|CGI returned 500 Internal Error
10.8.20.11|Tue 21 Jul 2015 09:56:33 +0100|/www/webs/production/httpdocs/index.php|CGI application timeout


What happened is that I copied my Wordpress web files from my old server (also running hiawatha) to this new server.

I really cannot understand why I get the
Gateway Timeout
504


I have created a new directory and unzip the wordpress file and from there, I have no issue is setting up a new wordpress installation...
So I know that php is working, I know that Hiawatha is working, I know that the proxy is redireding to correct jail..
I check the file permission and these look ok to me..

I am running out of ideas
Fred
21 July 2015, 12:52
Hugo,

Sorry I did the mistake in the last post..
When I try to setup a new wordpress website, I can get up to the screen asking me for the database connection details.
But as soon as I click on the Submit button I get the
Gateway Timeout 504 error message

bellow is the messages from the error log files
210.85.20.11|Tue 21 Jul 2015 11:43:42 +0100|/www/webs/development/httpdocs/wp-admin/setup-config.php|CGI application timeout
210.85.20.11|Tue 21 Jul 2015 11:46:04 +0100|/www/webs/development/httpdocs/wp-admin/setup-config.php|CGI application timeout

bellow is the messages from the access log files
210.85.20.11|Tue 21 Jul 2015 11:41:51 +0100|302|256||GET / HTTP/1.1|Connection: close|X-Hiawatha-RProxy-ID: 44fd18f969|Host: mydomain.com|User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8|Accept-Language: en,fr;q=0.7,en-US;q=0.3|Accept-Encoding: gzip, deflate|Forwarded: for="213.146.159.254"|X-Forwarded-For: 213.146.159.254|X-Forwarded-Proto: http|X-Forwarded-Host: mydomain.com|X-Forwarded-Port: 80
210.85.20.11|Tue 21 Jul 2015 11:41:53 +0100|200|2740||GET /wp-admin/setup-config.php HTTP/1.1|Connection: close|X-Hiawatha-RProxy-ID: 44fd18f969|Host: mydomain.com|User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8|Accept-Language: en,fr;q=0.7,en-US;q=0.3|Accept-Encoding: gzip, deflate|Forwarded: for="213.146.159.254"|X-Forwarded-For: 213.146.159.254|X-Forwarded-Proto: http|X-Forwarded-Host: mydomain.com|X-Forwarded-Port: 80
210.85.20.11|Tue 21 Jul 2015 11:41:53 +0100|304|168||GET /wp-includes/css/buttons.min.css?ver=4.2.2 HTTP/1.1|Connection: close|X-Hiawatha-RProxy-ID: 44fd18f969|Host: mydomain.com|User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0|Accept: text/css,*/*;q=0.1|Accept-Language: en,fr;q=0.7,en-US;q=0.3|Accept-Encoding: gzip, deflate|Referer: http://mydomain.com/wp-admin/setup-config.php|If-Modified-Since: Sun, 05 Apr 2015 21:20:27 GMT|Forwarded: for="213.146.159.254"|X-Forwarded-For: 213.146.159.254|X-Forwarded-Proto: http|X-Forwarded-Host: mydomain.com|X-Forwarded-Port: 80
210.85.20.11|Tue 21 Jul 2015 11:41:53 +0100|304|168||GET /wp-admin/css/install.min.css?ver=4.2.2 HTTP/1.1|Connection: close|X-Hiawatha-RProxy-ID: 44fd18f969|Host: mydomain.com|User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0|Accept: text/css,*/*;q=0.1|Accept-Language: en,fr;q=0.7,en-US;q=0.3|Accept-Encoding: gzip, deflate|Referer: http://mydomain.com/wp-admin/setup-config.php|If-Modified-Since: Thu, 23 Apr 2015 16:26:10 GMT|Forwarded: for="213.146.159.254"|X-Forwarded-For: 213.146.159.254|X-Forwarded-Proto: http|X-Forwarded-Host: mydomain.com|X-Forwarded-Port: 80
210.85.20.11|Tue 21 Jul 2015 11:41:53 +0100|304|175||GET /wp-includes/js/jquery/jquery.js?ver=1.11.2 HTTP/1.1|Connection: close|X-Hiawatha-RProxy-ID: 44fd18f969|Host: mydomain.com|User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0|Accept: */*|Accept-Language: en,fr;q=0.7,en-US;q=0.3|Accept-Encoding: gzip, deflate|Referer: http://mydomain.com/wp-admin/setup-config.php|If-Modified-Since: Fri, 24 Apr 2015 14:29:27 GMT|Forwarded: for="213.146.159.254"|X-Forwarded-For: 213.146.159.254|X-Forwarded-Proto: http|X-Forwarded-Host: mydomain.com|X-Forwarded-Port: 80
210.85.20.11|Tue 21 Jul 2015 11:41:53 +0100|304|175||GET /wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1 HTTP/1.1|Connection: close|X-Hiawatha-RProxy-ID: 44fd18f969|Host: mydomain.com|User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0|Accept: */*|Accept-Language: en,fr;q=0.7,en-US;q=0.3|Accept-Encoding: gzip, deflate|Referer: http://mydomain.com/wp-admin/setup-config.php|If-Modified-Since: Tue, 23 Jul 2013 15:28:25 GMT|Forwarded: for="213.146.159.254"|X-Forwarded-For: 213.146.159.254|X-Forwarded-Proto: http|X-Forwarded-Host: mydomain.com|X-Forwarded-Port: 80
210.85.20.11|Tue 21 Jul 2015 11:41:53 +0100|304|175||GET /wp-admin/js/language-chooser.min.js?ver=4.2.2 HTTP/1.1|Connection: close|X-Hiawatha-RProxy-ID: 44fd18f969|Host: mydomain.com|User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0|Accept: */*|Accept-Language: en,fr;q=0.7,en-US;q=0.3|Accept-Encoding: gzip, deflate|Referer: http://mydomain.com/wp-admin/setup-config.php|If-Modified-Since: Mon, 04 Aug 2014 20:47:16 GMT|Forwarded: for="213.146.159.254"|X-Forwarded-For: 213.146.159.254|X-Forwarded-Proto: http|X-Forwarded-Host: mydomain.com|X-Forwarded-Port: 80
210.85.20.11|Tue 21 Jul 2015 11:41:54 +0100|304|173||GET /wp-admin/images/wordpress-logo.svg?ver=20131107 HTTP/1.1|Connection: close|X-Hiawatha-RProxy-ID: 44fd18f969|Host: mydomain.com|User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0|Accept: image/png,image/*;q=0.8,*/*;q=0.5|Accept-Language: en,fr;q=0.7,en-US;q=0.3|Accept-Encoding: gzip, deflate|Referer: http://mydomain.com/wp-admin/css/install.min.css?ver=4.2.2|If-Modified-Since: Sun, 05 Apr 2015 21:20:27 GMT|Forwarded: for="213.146.159.254"|X-Forwarded-For: 213.146.159.254|X-Forwarded-Proto: http|X-Forwarded-Host: mydomain.com|X-Forwarded-Port: 80
210.85.20.11|Tue 21 Jul 2015 11:42:02 +0100|200|3090||GET /wp-admin/setup-config.php?step=1&language=en_GB HTTP/1.1|Connection: close|X-Hiawatha-RProxy-ID: 44fd18f969|Host: mydomain.com|User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8|Accept-Language: en,fr;q=0.7,en-US;q=0.3|Accept-Encoding: gzip, deflate|Referer: http://mydomain.com/wp-admin/setup-config.php|Forwarded: for="213.146.159.254"|X-Forwarded-For: 213.146.159.254|X-Forwarded-Proto: http|X-Forwarded-Host: mydomain.com|X-Forwarded-Port: 80
210.85.20.11|Tue 21 Jul 2015 11:42:02 +0100|304|168||GET /wp-includes/css/buttons.min.css?ver=4.2.2 HTTP/1.1|Connection: close|X-Hiawatha-RProxy-ID: 44fd18f969|Host: mydomain.com|User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0|Accept: text/css,*/*;q=0.1|Accept-Language: en,fr;q=0.7,en-US;q=0.3|Accept-Encoding: gzip, deflate|Referer: http://mydomain.com/wp-admin/setup-config.php?step=1&language=en_GB|If-Modified-Since: Sun, 05 Apr 2015 21:20:27 GMT|Forwarded: for="213.146.159.254"|X-Forwarded-For: 213.146.159.254|X-Forwarded-Proto: http|X-Forwarded-Host: mydomain.com|X-Forwarded-Port: 80
210.85.20.11|Tue 21 Jul 2015 11:42:02 +0100|304|168||GET /wp-admin/css/install.min.css?ver=4.2.2 HTTP/1.1|Connection: close|X-Hiawatha-RProxy-ID: 44fd18f969|Host: mydomain.com|User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0|Accept: text/css,*/*;q=0.1|Accept-Language: en,fr;q=0.7,en-US;q=0.3|Accept-Encoding: gzip, deflate|Referer: http://mydomain.com/wp-admin/setup-config.php?step=1&language=en_GB|If-Modified-Since: Thu, 23 Apr 2015 16:26:10 GMT|Forwarded: for="213.146.159.254"|X-Forwarded-For: 213.146.159.254|X-Forwarded-Proto: http|X-Forwarded-Host: mydomain.com|X-Forwarded-Port: 80
210.85.20.11|Tue 21 Jul 2015 11:42:02 +0100|304|175||GET /wp-includes/js/jquery/jquery.js?ver=1.11.2 HTTP/1.1|Connection: close|X-Hiawatha-RProxy-ID: 44fd18f969|Host: mydomain.com|User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0|Accept: */*|Accept-Language: en,fr;q=0.7,en-US;q=0.3|Accept-Encoding: gzip, deflate|Referer: http://mydomain.com/wp-admin/setup-config.php?step=1&language=en_GB|If-Modified-Since: Fri, 24 Apr 2015 14:29:27 GMT|Forwarded: for="213.146.159.254"|X-Forwarded-For: 213.146.159.254|X-Forwarded-Proto: http|X-Forwarded-Host: mydomain.com|X-Forwarded-Port: 80
210.85.20.11|Tue 21 Jul 2015 11:42:02 +0100|304|175||GET /wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1 HTTP/1.1|Connection: close|X-Hiawatha-RProxy-ID: 44fd18f969|Host: mydomain.com|User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0|Accept: */*|Accept-Language: en,fr;q=0.7,en-US;q=0.3|Accept-Encoding: gzip, deflate|Referer: http://mydomain.com/wp-admin/setup-config.php?step=1&language=en_GB|If-Modified-Since: Tue, 23 Jul 2013 15:28:25 GMT|Forwarded: for="213.146.159.254"|X-Forwarded-For: 213.146.159.254|X-Forwarded-Proto: http|X-Forwarded-Host: mydomain.com|X-Forwarded-Port: 80
210.85.20.11|Tue 21 Jul 2015 11:42:02 +0100|304|175||GET /wp-admin/js/language-chooser.min.js?ver=4.2.2 HTTP/1.1|Connection: close|X-Hiawatha-RProxy-ID: 44fd18f969|Host: mydomain.com|User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0|Accept: */*|Accept-Language: en,fr;q=0.7,en-US;q=0.3|Accept-Encoding: gzip, deflate|Referer: http://mydomain.com/wp-admin/setup-config.php?step=1&language=en_GB|If-Modified-Since: Mon, 04 Aug 2014 20:47:16 GMT|Forwarded: for="213.146.159.254"|X-Forwarded-For: 213.146.159.254|X-Forwarded-Proto: http|X-Forwarded-Host: mydomain.com|X-Forwarded-Port: 80
210.85.20.11|Tue 21 Jul 2015 11:43:42 +0100|500|853||POST /wp-admin/setup-config.php?step=2 HTTP/1.1|Connection: close|X-Hiawatha-RProxy-ID: 44fd18f969|Host: mydomain.com|User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8|Accept-Language: en,fr;q=0.7,en-US;q=0.3|Accept-Encoding: gzip, deflate|Referer: http://mydomain.com/wp-admin/setup-config.php?step=1&language=en_GB|Content-Type: application/x-www-form-urlencoded|Content-Length: 158|Forwarded: for="213.146.159.254"|X-Forwarded-For: 213.146.159.254|X-Forwarded-Proto: http|X-Forwarded-Host: mydomain.com|X-Forwarded-Port: 80
210.85.20.11|Tue 21 Jul 2015 11:46:04 +0100|500|853||POST /wp-admin/setup-config.php?step=2 HTTP/1.1|Connection: close|X-Hiawatha-RProxy-ID: 44fd18f969|Host: mydomain.com|User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8|Accept-Language: en,fr;q=0.7,en-US;q=0.3|Accept-Encoding: gzip, deflate|Referer: http://mydomain.com/wp-admin/setup-config.php?step=1&language=en_GB|Content-Type: application/x-www-form-urlencoded|Content-Length: 121|Forwarded: for="213.146.159.254"|X-Forwarded-For: 213.146.159.254|X-Forwarded-Proto: http|X-Forwarded-Host: mydomain.com|X-Forwarded-Port: 80
Fred
21 July 2015, 17:03
Solved it
This topic has been closed.