mardi 27 mars 2018

Configure Apache with multiple ProxyPass and different ports

so i have a config file that states this

<VirtualHost *:80>
  ProxyPreserveHost On
  ProxyRequests Off
  ServerName www.aaaaaaaa.yyyyyyyyy.co.uk
  ServerAlias aaaaaaa.yyyyyyy.co.uk
  ProxyPass / http://localhost:5000/
  ProxyPassReverse / http://localhost:5000/
  RewriteEngine on
  RewriteCond %{SERVER_NAME} =www.aaaaaaa.yyyyyyyyy.co.uk [OR]
  RewriteCond %{SERVER_NAME} =aaaaaa.yyyyyyyyy.co.uk
  RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<VirtualHost *:80>
  ProxyPreserveHost On
  ProxyRequests Off
  ServerName www.xxxxxx.yyyyyyyy.co.uk
  ServerAlias xxxxxxx.yyyyyyyyy.co.uk
  ProxyPass / http://localhost:8989/
  ProxyPassReverse / http://localhost:8989/
  RewriteEngine on
  RewriteCond %{SERVER_NAME} =www.xxxxxxxxxxx.yyyyyyyy.co.uk [OR]
  RewriteCond %{SERVER_NAME} =xxxxxx.yyyyyyyyyy.co.uk
  RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

when visiting aaaaaaa.yyyyyyyyy.co.uk it redirects to https which is the desiered effect and launches the correct app.

however when i visit xxxxx.yyyyyyy.co.uk it shows the correct app but does not redirect to https, when i physically type https://xxxx.yyyyyy.co.uk it redirects me to the same app as aaaaaaa.yyyyyyyyyy.co.uk.

how can i make this work!




Aucun commentaire:

Enregistrer un commentaire