mardi 6 octobre 2020

Apache2 reverse proxy for nodejs application

I am trying to set up a reverse proxy on an apache server, so that traffic to a subdomain will go to my nodejs application, and it is not working. I have the apache proxy and http_proxy mods enabled. Is there something I may have missed or done wrong? Here is my apache configuration for my site.

I also noticed that when I saved the configuration, it added the rewrite engine stuff automatically, could that have something to do with the issue?

<VirtualHost *:80>
     ServerAdmin admin@website.com
     DocumentRoot /var/www/html
     ServerName website.com
     ServerAlias www.website.com

     <Directory /var/www/html/>
          Options FollowSymlinks
          AllowOverride All
          Require all granted
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined

RewriteEngine on
RewriteCond %{SERVER_NAME} =www.website.com [OR]
RewriteCond %{SERVER_NAME} =website.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

<VirtualHost *:80>
        ServerName auth.website.com
        ProxyPreserveHost On
        ProxyRequests On
        ProxyPass / http://localhost:3000/
        ProxyPassReverse / http://localhost:3000/
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.website.com [OR]
RewriteCond %{SERVER_NAME} =auth.website.com [OR]
RewriteCond %{SERVER_NAME} =website.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>



Aucun commentaire:

Enregistrer un commentaire