I'm having some difficulty getting M/Monit to work behind a proxy. I'm trying to proxy HTTPS connections from https: //monit.mydomain.com to http: //monit.realserver.com:8082.
With the configuration below, if I visit https: //monit.mydomain.com/index.csp or any other valid path then everything works fine. However, if I try to visit just https:/ /monit.mydomain.com or https: //monit.mydomain.com/, it redirects to http: //monit.mydomain.com:8082/index.csp
[root@uk1001 conf.d]# curl -k -v --fail https://monit.mydomain.com
* About to connect() to monit.mydomain.com port 443 (#0)
* Trying 10.0.35.80... connected
* Connected to monit.mydomain.com (10.0.35.80) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* warning: ignoring value of ssl.verifyhost
* skipping SSL peer certificate verification
* SSL connection using TLS_DHE_RSA_WITH_AES_128_CBC_SHA
* Server certificate:
... omitted cert details ...
> GET / HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.3.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: monit.mydomain.com
> Accept: */*
>
< HTTP/1.1 302 Moved Temporarily
< Date: Thu, 26 Jan 2017 11:20:01 GMT
< Server: mmonit/3.5
< Content-Type: text/plain; charset=UTF-8
< Location: http://monit.mydomain.com:8082/index.csp
< Connection: close
< Transfer-Encoding: chunked
<
Here's my vhost config:
<VirtualHost *:443 >
ServerName monit.mydomain.com
SSLEngine on
SSLProxyEngine on
ProxyRequests Off
ProxyPreserveHost On
RequestHeader set X-FORWARDED-PROTO "https"
ProxyPass / http://monit.realserver.com:8082/ connectiontimeout=5 timeout=300
ProxyPassReverse / http://monit.realserver.com:8082/
</VirtualHost>