1. Home
  2. Platform Administration
  3. Setting Up Reverse Proxy on APACHE

Setting Up Reverse Proxy on APACHE

Important: If you haven’t already, please read through the How to Setup Reverse Proxy for a PathFactory Instance before reading this article.

A reverse proxy, whether it’s a server, application, or cloud service, acts as a middleman, managing and optimizing the flow of information between visitors and the website domains they want to access. When using reverse proxy with PathFactory, visitors experience a seamless navigation flow and see PathFactory destination experiences as subfolder/subdirectory URLs within your primary domain folder structure vs. as a subdomain – i.e., companydomain.com/resourcehub vs. resourcehub.companydomain.com. Additionally, reverse proxy enhances security and helps distribute incoming requests across multiple servers to balance the load on busy websites.

Some reverse proxies, such as Apache’s mod_proxy, change the hostname on the request header by default, and replace it with the hostname of the origin server. For example, it would change Host: www.mycompany.com/subdirectory/content track/ to Host: mycompany.pathfactory.com/. Because the goal is to show the opposite – the subdirectory URL not the subdomain URL structure, you must specifically take action to override the default behavior. For example, to preserve the original host in an Apache configuration file (usually httpd.conf or apache2.conf), you can add the following line to the configuration file: “ProxyPreserveHost On.” This will ensure that the original host is kept on the proxied request, and the Host header will not be modified by the reverse proxy. Read more about modifying the .conf file, below.

Example 1: Configure Reverse Proxy by Updating the .conf File

  1. Add the following lines to the Apache configuration file to enable SSL and set up the reverse proxy.
SSLProxyEngine On

SSLProxyCheckPeerCN off

SSLProxyCheckPeerName off

SSLProxyCheckPeerExpire off

# Optional: Add Headers

ProxyAddHeaders On

RequestHeader set X-Forwarded-Host proxy-pathfactory-development.com

RequestHeader set X-Real-IP $remote_addr

RequestHeader set X-Forwarded-For $proxy_add_x_forwarded_for

# Reverse Proxy Redirect

ProxyPass /rp-test https://infra-test.pathfactory.com/rp-test

ProxyPassReverse /rp-test https://infra-test.pathfactory.com/rp-test

ProxyPreserveHost On

  1. Save the .conf file.

Example 2: Set Up Reverse Proxy Via .htaccess File

  1. Update the .conf file by adding the following configuration within the <VirtualHost> block.
<IfModule mod_ssl.c>

<VirtualHost *:443>

 ServerAdmin webmaster@localhost

 ServerName proxy-pathfactory-development.com

 ServerAlias proxy-pathfactory-development.com

 DocumentRoot /var/www/proxy-pathfactory-development.com

 ErrorLog ${APACHE_LOG_DIR}/error.log

 CustomLog ${APACHE_LOG_DIR}/access.log combined

 SSLCertificateFile /etc/letsencrypt/live/proxy-pathfactory-development.com/fullchain.pem

 SSLCertificateKeyFile /etc/letsencrypt/live/proxy-pathfactory-development.com/privkey.pem

 Include /etc/letsencrypt/options-ssl-apache.conf

 SSLProxyEngine On

 SSLProxyCheckPeerCN off

 SSLProxyCheckPeerName off

 SSLProxyCheckPeerExpire off



  1. Enable the .htaccess file by adding the following configuration to enable .htaccess file usage.
AccessFileName .htaccess

<Directory "/var/www/proxy-pathfactory-development.com">

AllowOverride All


  1. Navigate to the DocumentRoot directory (/var/www/proxy-pathfactory-development.com).
  2. Add the following configuration to enable .htaccess file usage.
<IfModule mod_proxy_http.c>

 RewriteEngine on

 RewriteRule "^rp-test/(.*)$" "https://infra-test.pathfactory.com/rp-test/$1" [P]


  1. Save the .htaccess file.
Updated on March 26, 2024

Was this article helpful?

Need Support?
Can't find the answer you're looking for? Don't worry we're here to help!