Skip to main content

Configuring Reverse Proxy

There are two solutions if you want to configure a reverse proxy for your application:

Solution 1: Use Default Domain of Pub-server

  • In this case, you can access Web2Publish through the domain of the PubServer.
  • Example: pubserver.priintsuite.com/w2p/

Configure Apache2 Reverse Proxy

Note: If using another reverse proxy (e.g., Nginx), the process will be similar.

Step 1: Edit the configuration file (run with sudo permissions)

sudo nano /etc/apache2/sites-available/priintsuite.conf

Step 2: Identify your Spring Boot application's IP and port

(Assuming the Web2Publish application runs on localhost:8688)

Step 3: Add the following configuration lines

    RequestHeader set X-Forwarded-Proto "https"

ProxyPass /w2p http://127.0.0.1:8080/w2p timeout=1200
ProxyPassReverse /w2p http://127.0.0.1:8080/w2p timeout=1200

Step 4: Check Apache configuration syntax

apachectl configtest

Step 5: Reload/Restart Apache

sudo systemctl restart apache2

Solution 2: Create and Use a New Custom Domain

  • If you want to use a different domain instead of the Pub Server domain follow these steps.
  • Example: w2p-priintsuite.com

Configure Apache2 Reverse Proxy

Step 1: Create a New Domain Configuration File

Add configuration file /etc/apache2/sites-available/w2p.conf and add the following content:

    <VirtualHost *:443>
ServerName w2p-priintsuite.com
ServerAdmin it-group@priint.com
ErrorLog ${APACHE_LOG_DIR}/error_proxy.log
CustomLog ${APACHE_LOG_DIR}/access_proxy.log combined

ProxyRequests Off

SSLProxyEngine On
SSLProxyVerify none
SSLProxyCheckPeerName off
SSLProxyCheckPeerCN off
SSLProxyCheckPeerExpire off
SSLProxyProtocol +TLSv1.2 +TLSv1.3

ProxyPass / http://127.0.0.1:8080/ timeout=1200
ProxyPassReverse / http://127.0.0.1:8080/ timeout=1200


SSLEngine on
SSLCertificateFile /etc/ssl/certs/priintsuite.com.crt.pem
SSLCertificateKeyFile /etc/ssl/private/priintsuite.com.key.pem
SSLCertificateChainFile /etc/ssl/certs/priintsuite.com.ca.pem

</Virtualhost>

<VirtualHost *:80>

ServerName w2p-priintsuite.com
Redirect permanent / https://w2p-priintsuite.com

</VirtualHost>

Step 2: Enable the New Virtual Host and Restart Apache

sudo a2ensite w2p.conf
sudo systemctl restart apache2

Notes:

  • Ensure the SSL certificates are properly configured.
  • If using a different reverse proxy, adjust the configuration accordingly.
  • Run sudo apachectl configtest` before restarting Apache to verify configuration correctness.