1

I want to send traffic directed to remote.mydomain.com to a windows server with an internal ip address. Traffic from outside hits our public ip address and is directed to our ubuntu server 14.04 box, where also our website is hosted.

Currently we are using using vhost proxypass to redirect traffic to windows server:

<VirtualHost *:80>
    ServerName remote.mydomain.com
    ProxyPass / http://172.18.1.8:80/
    ProxyPassReverse / http://172.18.1.8:80/
</VirtualHost>

But the problem is that, the browser shows the internal ip address like this:

http://172.18.1.8/Remote/.....

I also need to setup ssl at the windows box.

Any input would be appreciated.

Solution:

add 'ProxyPreserveHost On'in the vhost .conf

and

ProxyPreserveHost On
ProxyPass /remote http://172.18.1.8:80/
ProxyPassReverse /remote http://172.18.1.8:80/

in the vhost .conf of the domain itself and it works now.

stadtkind
  • 13
  • 4
  • Can you please try with `ProxyPreserveHost On` added to your vhost config? You may add it under `ServerName remote.mydomain.com`. – Diamond Nov 19 '15 at 15:49
  • We are getting further to `https://remote.mydomain.com/remote` but it ends abruptly with a connection timed out. – stadtkind Nov 19 '15 at 16:04
  • Have you configured ssl already? If not, then try with `http`. – Diamond Nov 19 '15 at 16:53
  • thanks! i added `ProxyPreserveHost On` and 'ProxyPreserveHost On' 'ProxyPass /remote http://172.18.1.8:80/' 'ProxyPassReverse /remote http://172.18.1.8:80/' and left it for a night and it works now. – stadtkind Nov 20 '15 at 14:35
  • Glad that it worked. I have added it as an answer, will add some clarification to it soon. – Diamond Nov 20 '15 at 14:45

1 Answers1

1

You may add the option ProxyPreserveHost On in your virtual host configuration file vhos.conf, which should solve your problem. Your config should look like this.

ProxyPreserveHost On
ProxyPass /remote http://172.18.1.8:80/
ProxyPassReverse /remote http://172.18.1.8:80/

When enabled, this option will pass the Host: line from the incoming request to the proxied host, instead of the hostname specified in the ProxyPass module="mod_proxy" line.

As stated in Apache docs here: http://httpd.apache.org/docs/2.2/mod/mod_proxy.html

Diamond
  • 8,791
  • 3
  • 22
  • 37