For our examples we will use the following:
MAD runs on localhost
madmin_port
is port 5000
ws_port
is 8080
mitmreceiver_port
is 8000
We wish to access MADmin at example.com/madmin
We wish to proxy the RGC traffic to example.com/rgc
We wish to proxy the PogoDroid traffic to example.com/pd
The FQDN (Domain) we are using is example.com
SSL Certificate is located at /etc/letsencrypt/live/example.com/cert.pem
SSL Certificate Key is located at /etc/letsencrypt/live/example.com/privkey.pem
Every proxy endpoint will be encrypted with SSL, make sure to adjust the path:
ssl_certificate /etc/letsencrypt/live/example.com/cert.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
The reverse proxy relies on the header, X-Script-Name
, to inform MADmin on how to construct the URIs.
MADmin URL: https://example.com/madmin
location ~ /madmin(.*)$ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Script-Name /madmin;
proxy_set_header Host $host;
proxy_pass http://localhost:5000$1$is_args$args;
client_max_body_size 200M;
}
RGC URL: wss://example.com/rgc
(note the extra S in the protocol).
location /rgc {
proxy_pass http://localhost:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# WebSocket support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
PogoDroid URL: https://example.com/pd
(note the extra S in the protocol).
location /pd {
proxy_pass http://localhost:8000/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
}