Proxy Admaxxer Through Apache (mod_proxy)

Apache HTTP Server's mod_proxy and mod_proxy_http modules let you forward specific URL paths to an upstream server while keeping your domain in the browser. This is the standard approach for any Apache-served site — shared hosting excluded, since shared hosts typically disable mod_proxy.

Why Proxy?

Prerequisites

Step 1 — Enable Proxy Modules

sudo a2enmod proxy proxy_http ssl
sudo systemctl reload apache2

Verify they loaded:

apache2ctl -M | grep -E 'proxy|ssl'

You should see proxy_module and proxy_http_module in the list.

Step 2 — Add ProxyPass Directives to Your VirtualHost

Edit your virtual host config (e.g., /etc/apache2/sites-available/yourdomain.conf) and add inside the <VirtualHost> block:

<VirtualHost *:443>
  ServerName yourdomain.com
  # ... existing SSL, DocumentRoot, etc. ...

  # Admaxxer pixel proxy
  SSLProxyEngine on
  ProxyPreserveHost Off

  ProxyPass        /js/script.js    https://admaxxer.com/js/script.js
  ProxyPassReverse /js/script.js    https://admaxxer.com/js/script.js

  ProxyPass        /api/event       https://admaxxer.com/api/event
  ProxyPassReverse /api/event       https://admaxxer.com/api/event

</VirtualHost>

SSLProxyEngine on is required because the upstream uses HTTPS. ProxyPreserveHost Off sends Host: admaxxer.com to the upstream rather than your domain — required for SNI on the Admaxxer side.

Step 3 — Test the Config and Reload

sudo apachectl configtest
sudo systemctl reload apache2

Always run configtest before reloading to catch syntax errors.

Step 4 — Update the Admaxxer Snippet

In Admaxxer go to Connections › Install, enable Custom proxy domain, and enter your domain. Copy the regenerated snippet and update your site's HTML.

Step 5 — Test the Proxy

curl -I https://yourdomain.com/js/script.js
# Expect: HTTP/2 200  content-type: application/javascript

curl -v -X POST https://yourdomain.com/api/event \
  -H 'Content-Type: application/json' \
  -d '{"name":"pageview","url":"https://yourdomain.com/"}'
# Expect: HTTP/2 200 or 204

Optional: .htaccess Method (no VirtualHost access)

If you cannot edit the VirtualHost config but mod_proxy is enabled, use .htaccess:

RewriteEngine On
RewriteRule ^js/script\.js$ https://admaxxer.com/js/script.js [P,L]
RewriteRule ^api/event(.*)$ https://admaxxer.com/api/event$1 [P,L,QSA]

The [P] flag triggers mod_proxy internally. Note: AllowOverride All must be set in your VirtualHost for .htaccess to work.

Troubleshooting

Rollback

Remove the ProxyPass and ProxyPassReverse lines from the VirtualHost, run apachectl configtest, and reload Apache. Disable the custom proxy domain in Admaxxer to revert the snippet.

Other Proxy Guides

Cloudflare · Vercel · Next.js · Nuxt · Netlify · WordPress · NGINX

See also: Connections › Install for the base snippet.