0

I have installed a webapp in a virtual machine on my server (both running Debian 8 and Apache2). I used a reverse proxy on the host machine to redirect all the connections made to https://webapp.domain.com to the internal address of the webapp on the virtual machine (http://192.168.100.101/webapp) using the following vhost configuration:

<IfModule mod_proxy.c>
<VirtualHost *:443>
ServerName webapp.domain.com
ServerAlias www.webapp.domain.com
SSLProxyEngine On
SSLProxyCheckPeerExpire off
SSLProxyCheckPeerCN off
SSLProxyVerify none
ProxyPass / http://192.168.100.101/webapp/
ProxyPassReverse / http://192.168.100.101/webapp/
SSLEngine on
SSLCertificateFile    /etc/letsencrypt/live/webapp.domain.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/webapp.domain.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/webapp.domain.com/fullchain.pem

ServerAdmin unavailable
CustomLog ${APACHE_LOG_DIR}/vhosts/webapp_access.log combined
ErrorLog ${APACHE_LOG_DIR}/vhosts/webapp_error.log
<IfModule mod_headers.c>
    Header always set Strict-Transport-Security "max-age=15768000; includeSubDomains; preload"
</IfModule>

<Proxy *>
Order Allow,Deny
Allow from all
</Proxy>

</VirtualHost>
</IfModule>

However if I try to connect to any address on the ip of the host machine, I end up seeing the webapp on the virtual machine (i.e., let's assume that the public IP of the host machine is 10.10.10.10, connecting to https://10.10.10.10/anything shows me the webapp on the virtual machine).

How can I prevent this from happening? Could it be the guest machine configuration the cause of this?

-1

I think the problem is here

ProxyPass / http://192.168.100.101/webapp/
ProxyPassReverse / http://192.168.100.101/webapp/

You are saying that every url using "/" needs to go to anotherIp/webapp/ .

Specifying webapp should solve the problem:

ProxyPass /webapp http://192.168.100.101/webapp 
ProxyPassReverse /webapp http://192.168.100.101/webapp
  • Thank you very much! Maybe I should use webapp.domain.com instead of /webapp? Since I expect users to connect to webapp.domain.com in order to access the webapp. Makes sense? – giovi321 Aug 29 '17 at 15:48
  • You are already there, i mean webapp.domain.com is your localhost you don't need to specify that. – Daniel Guerrero Aug 29 '17 at 16:07
  • This does not solve the problem. webapp.domain.com should show what is at 192.168.100.101 (regardless to whether it is webapp.domain.com or webapp.domain.com/webapp). The problem is that 10.10.10.10 (that is the ip of the host machine) shows what is at 192.168.100.101. – giovi321 Aug 29 '17 at 16:33
  • try with this: ProxyPass / "192.168.100.101" ProxyPassReverse / "192.168.100.101" – Daniel Guerrero Aug 29 '17 at 18:26
  • Unfortunately this does not solve the issue – giovi321 Aug 30 '17 at 7:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.