16 reverse proxy
Jona Abdinghoff edited this page 2022-05-05 18:43:01 +02:00

nginx

basic

location ~ ^/(static|register) {
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_pass http://localhost:5000;
}

advanced

If you want to use your own registration page, since you for example already have a static webpage in /var/www/html you can use this setup that only proxies POST requests to the application

root /var/www/html;

location /register {
    alias /var/www/html/register.html;

    if ($request_method = POST ) {
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_pass http://localhost:5000;
    }
}

See this resources/example.html for a very basic example for a registration page

optional

If you want to create/disable/list tokens not just locally, but also over the internet you should also proxy pass the /api location.

location ~ ^/(static|register|api) {
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_pass http://localhost:5000;
}

To access this URL you need to send a Authorization Header with your admin api shared secret

Authorization: SharedSecret verysecuresecret

apache

basic

<LocationMatch "^/(register|static)">
    ProxyPassMatch http://localhost:5000
    ProxyPassReverse http://localhost:5000
</LocationMatch>