Proxy Admaxxer Through WordPress

WordPress sites typically run on Apache or NGINX with PHP. There are three ways to proxy the Admaxxer pixel depending on your hosting setup: .htaccess rules (Apache), NGINX configuration, or a small PHP proxy endpoint. Choose the method that matches your server stack.

Why Proxy?

Method 1 — .htaccess (Apache)

Open your site's .htaccess file (in the WordPress root) and add these rules before the # BEGIN WordPress block:

# Admaxxer pixel proxy
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 enables mod_proxy. Confirm your Apache installation has mod_proxy and mod_proxy_http enabled:

apache2ctl -M | grep proxy

If mod_proxy is not available, use Method 3 (PHP endpoint) instead.

Method 2 — NGINX (self-hosted WordPress)

Add a location block to your WordPress server block (typically in /etc/nginx/sites-available/yourdomain.conf):

location = /js/script.js {
    proxy_pass https://admaxxer.com/js/script.js;
    proxy_ssl_server_name on;
    proxy_set_header Host admaxxer.com;
}

location ^~ /api/event {
    proxy_pass https://admaxxer.com;
    proxy_ssl_server_name on;
    proxy_set_header Host admaxxer.com;
}

Test and reload NGINX:

nginx -t && systemctl reload nginx

Method 3 — PHP Proxy Endpoint (any host)

Create a file at wp-content/uploads/admaxxer/proxy.php (or any non-blocked path):

<?php
// Admaxxer pixel proxy
// Map: /admaxxer-proxy.php?r=script  →  /js/script.js
//      /admaxxer-proxy.php?r=event   →  /api/event

$route = $_GET['r'] ?? '';
$upstreamBase = 'https://admaxxer.com';

if ($route === 'script') {
    $url = $upstreamBase . '/js/script.js';
    $response = file_get_contents($url);
    header('Content-Type: application/javascript');
    echo $response;
    exit;
}

if ($route === 'event') {
    $body = file_get_contents('php://input');
    $opts = [
        'http' => [
            'method'  => $_SERVER['REQUEST_METHOD'],
            'header'  => 'Content-Type: application/json',
            'content' => $body,
        ],
    ];
    $ctx = stream_context_create($opts);
    $resp = file_get_contents($upstreamBase . '/api/event', false, $ctx);
    http_response_code(200);
    echo $resp;
    exit;
}

http_response_code(404);
echo 'Not found';

Then update the Admaxxer snippet to point data-api at /admaxxer-proxy.php?r=event and load the script from /admaxxer-proxy.php?r=script. This method works on any PHP host that allows file_get_contents with remote URLs (most do).

Step — Update Admaxxer Snippet

In Admaxxer go to Connections › Install, enable Custom proxy domain, and enter your WordPress domain. Paste the updated snippet into your theme's <head> (via Appearance › Theme Editor › header.php or the Code Snippets plugin). If using Method 3, manually set the src and data-api attributes to the PHP proxy URLs.

Test

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

Troubleshooting

Rollback

Remove the .htaccess rules or NGINX location blocks and reload the server. Delete the PHP proxy file if you used Method 3. Disable the custom proxy domain in Admaxxer.

Other Proxy Guides

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

See also: Connections › Install for the base snippet.