'Proxy redirect is not working properly on apache2?
I have a web-app running on a proxy using apache2 on my default domain (domain1). I now want a second domain (domain2) to access the subfolder on the web-app, but I can't manage to get it working. domain2 always shows the content domain1 displays, no matter what I try..
Here are my configs for both domains:
<VirtualHost domain1.com:*>
ProxyRequests Off
ProxyPreserveHost On
ProxyVia Full
<Proxy *>
Require all granted
</Proxy>
ProxyPass / http://localhost:3000/
RewriteEngine on
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/?(.*) "ws://localhost:3000/$1" [P,L]
#SSL
Include /etc/letsencrypt/options-ssl-apache.conf
ServerName domain1.com
ServerAlias www.domain1.com
SSLCertificateFile /etc/letsencrypt/live/www.domain1.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.domain1.com/privkey.pem
</VirtualHost>
<VirtualHost domain2.com:80>
Redirect permanent / https://domain2.com/
ServerName domain2.com
</VirtualHost>
<VirtualHost domain2.com:433>
ProxyRequests Off
ProxyPreserveHost On
ProxyVia Full
<Proxy *>
Require all granted
</Proxy>
ProxyPass / http://localhost:3000/subfolder/
ProxyPassReverse / http://localhost:3000/subfolder/
RewriteEngine On
#SSL
Include /etc/letsencrypt/options-ssl-apache.conf
ServerName domain2.com
ServerAlias www.domain2.com
SSLCertificateFile /etc/letsencrypt/live/www.domain1.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.domain1.com/privkey.pem
</VirtualHost>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
