Jump to content

App can't connect to NGINX reverse proxy


Recommended Posts

Posted

Hey there,

 

I can get the emby app to connect to my server that is behind an NGINX reverse proxy only if my "root" nginx site redirects to emby. However I'd like to not have the root nginx sit to redirect to emby. 

 

 

-----This works-------

Emby Android App config

 

https://mydomain.org/

port 8080

 

nginx relavant config

 
        location /  {
 
        proxy_pass http://x.x.x.x:8096;
 
-----This doesn't work but I want it to------
port 8080
 
I have tried with a trailing "/" as well
 
nginx relavant config
 
 location /emby {
 
        proxy_pass http://x.x.x.x:8096;

 

Have tried with a

        rewrite /emby/(.*) /$1 break;
Have tried it with /emby/
 
The Error is always "Connection Failure, we're unable to connect to the selected server right now"
 
All the permutations of redirects work from a browser (on android too), but do not work from the Emby app. Is there a specific syntax that can make this work?
 
Thanks
 
pir8radio
Posted (edited)
location /emby/ { #note the backslash after emby
rewrite ^/emby(/.*)$ $1 break; #this will strip /emby from the requests going into emby backend
proxy_pass http://server:8096;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $remote_addr;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_redirect off;

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}

if the above doesnt work, post your whole nginx config.     the subdirectory method you are trying sucks, it messes with applications, the point of a reverse proxy should be to make it transparent..  the best way to go about it is something like    EMBY.mydomain.com/       far less problems. 

Edited by pir8radio
Posted

The piece of the puzzle I was missing was I wasn't paying for wildcard redirects with the domain provider. Once I enabled that I could use emby.mydomain.com, and the the final config that works in nginx and the Android App, is

location / {

        #rewrite ^/emby(/.*)$ $1 break;

        proxy_pass http://server:8096;

        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Proto $remote_addr;
        proxy_set_header X-Forwarded-Protocol $scheme;
        proxy_redirect off;

        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        }
 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...