Jump to content

Sync with reverse proxy not working correctly


PhyberApex
Go to solution Solved by pir8radio,

Recommended Posts

PhyberApex

Okay this error may be due to a misconfiguration on my part. Here is my setup

 

Emby is running on port 8004

mydomain.de - links to my nginx server

mydomain.de/emby is configured in nginx to proxy_pass to localhost:8004

 

This works fine for the web version as well as the app until I want to activate a sync.

 

I get in the log files:

System.IO.FileNotFoundException: Unable to find the specified file.

for 

http://mydomain.de:8004/emby/mediabrowser/users/xxx?format=json

which makes the error correct as the way to go would not be

http://mydomain.de:8004/emby/ but instead

http://mydomain.de/emby/(Port 80) or even "https://mydomain.de/emby/" (Port 443)

I have the feeling I am missing a config here. Any help is appreciated.

 

~Cheers

Edited by PhyberApex
Link to comment
Share on other sites

pir8radio

Post your nginx config, and a screenshot of your Emby port settings. You can cover up or remove your actual domain name if you like.

Link to comment
Share on other sites

PhyberApex

Nginx config

server {
        listen 80 default_server;
        return 301 https://DOMAIN$request_uri;
}
server {


 location /emby {
                proxy_pass http://localhost:8004;
                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";
        }


        listen 443 ssl;
        ssl_certificate /etc/letsencrypt/live/DOMAIN/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/DOMAIN/privkey.pem;
        server_name DOMAIN;
}

there is more but has nothing todo with emby and I think this part should be fine.

This is the config I have atm in emby. I think here is my error somewhere.
 58b49ea18efee_2017022722_47_56.png
 
~Cheers
Link to comment
Share on other sites

pir8radio

What happens with your domain name. whatever.com is entered in the Emby "External domain" field? Uncheck "report https as external address". Emby is not handling https nginx is, I don't know if an instance in a reverse proxy where you need that checked, I may be wrong though. I don't... I have a feeling the /Emby/ is what's messing with things. I would strip it off so it is not sent to your backend Emby server.

Edited by pir8radio
  • Like 1
Link to comment
Share on other sites

PhyberApex

I removed the checkbox don't know why I enabled that anyway. If I but my domain name into the "external domain" field it doesn't change anything. I am not able to strip off the /emby part as I have multiple services running on that machine listening to different ports. As I mentioned above the error I'm seeing in the log is that if I try to sync media to my android device I get a 404 for the resource: http://mydomain.de:8004/emby/mediabrowser/users/. That error is correct because emby is not reachable from there the port "8004" should not be there. Like I said everything is working fine EXCEPT syncing. Currently I am able to workaround this issue by just using the local IP as server where the port works but I can't access emby from outside my LAN then. I have to "switch" servers every time I am at home / be somewhere else.

 

~Cheers

Link to comment
Share on other sites

  • Solution
pir8radio

I removed the checkbox don't know why I enabled that anyway. If I but my domain name into the "external domain" field it doesn't change anything. I am not able to strip off the /emby part as I have multiple services running on that machine listening to different ports. As I mentioned above the error I'm seeing in the log is that if I try to sync media to my android device I get a 404 for the resource: http://mydomain.de:8004/emby/mediabrowser/users/. That error is correct because emby is not reachable from there the port "8004" should not be there. Like I said everything is working fine EXCEPT syncing. Currently I am able to workaround this issue by just using the local IP as server where the port works but I can't access emby from outside my LAN then. I have to "switch" servers every time I am at home / be somewhere else.

 

~Cheers

 

No I dont mean strip it off of your entrance url, but strip it from sending to emby....   something like below (if that doesnt work post what 404 you get now)  I understand you see the port 8004 in the emby server logs,  ignore it its a problem with how emby logs things when using a reverse proxy..   try the below.  Your issue is that /emby/mediabrowser/users is not a valid path..   /mediabrowser/users is however.  what you see in the emby logs is what emby is serving to nginx not your client.

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://localhost:8004;
                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 $http_connection;
} 
Edited by pir8radio
  • Like 1
Link to comment
Share on other sites

PhyberApex

 

No I dont mean strip it off of your entrance url, but strip it from sending to emby....   something like below (if that doesnt work post what 404 you get now)  I understand you see the port 8004 in the emby server logs,  ignore it its a problem with how emby logs things when using a reverse proxy..   try the below.  Your issue is that /emby/mediabrowser/users is not a valid path..   /mediabrowser/users is however.  what you see in the emby logs is what emby is serving to nginx not your client.

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://localhost:8004;
                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";
        }


        listen 443 ssl;
        ssl_certificate /etc/letsencrypt/live/DOMAIN/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/DOMAIN/privkey.pem;
        server_name DOMAIN;
}

Holy shit this did the trick! Thank you so much would've never guessed that. That port in the logfile really threw me off to a totally wrong direction. Thank you so much for your help! Now it would be really nice to limit the sync to certain SSID / Networks but that's a different story and I will wait until offline playback actually works in the app for that.

 

Again thanks!

 

~Cheers

  • Like 1
Link to comment
Share on other sites

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...