kilianc/rtail

Howto reverse proxy via nginx

kaihendry opened this issue · 10 comments

How does one reverse proxy rtail?

    server {
            server_name irc.dabase.com;
            location / {
                proxy_pass http://localhost:8888;
            }
    }

Thanks for contributing @kaihendry, please move this question to a nginx forum or gitter

I eventually figured it out. Wouldn't you want to document this somewhere?

    server {
            server_name irc.dabase.com;
            location / {
                proxy_pass http://localhost:8888;
            }

            location /socket.io/ {
                proxy_pass http://localhost:8888;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
            }
    }

thanks, this helped me a lot 👍

ploef commented

Hi,

This seems to work but onfortunately I can't use the root of the server. Did anybody get this to work using an relative root? Like:

location /rtail

ploef commented

Does anybody know how to make this work?

location /logs {
proxy_pass http://localhost:8888;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
#proxy_set_header Host $host;
#proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_set_header X-Forwarded-Proto $scheme;
}

can you paste your whole nginx config?

ploef commented

Hi,

Next to the standard nginx.conf (nothing changed there) I use this config in the config.d folder.
I would like rtail to be accessed by http://myserver/logs.
Unfortunately, this results in a 403 error:

403 Forbidden
Code: AccessDenied
Message: Access Denied
RequestId: A2D9E37B0166D862
HostId: MBqEwGR+qdZSWEqvDeQwe+u6Fa2wdPlEO5yJP1+Mrv01ne+bhjLyIrF2vyU+DcXTxTLspBehlAs=

server {
    listen 80;
    server_name myserver;

    location /logs {
        proxy_pass http://localhost:8888;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        #proxy_set_header Host $host;
        #proxy_set_header X-Real-IP $remote_addr;
        #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        #proxy_set_header X-Forwarded-Proto $scheme;
    }
}
ploef commented

Hi,

Does anybody have an idea how to get this working. Running rtail server on the root of server is no problem, but I'm realy hoping it would be possible to use virtual roots so I can run multiple servers on the same port.

Regards,
Peter

hello there I have the same problem I want to run rtails in a sub path like example.com/logs but I get this error

Cannot GET /logs

seems that is a problem with express

anyone could do that?

In Apache, you would do something like this, with a Location directive:

<Location /logs/>
ProxyPass http://127.0.0.1:8888/
ProxyPassReverse http://127.0.0.1:8888/
</Location>

Just make sure to add the trailing / in the url, like
http://domain.tld/logs/