Jump to content

The server address conf changed unexpectedly after restart app


david_666

Recommended Posts

david_666

I have a Emby server on Windows with port 8098 and a Nginx server before it with port 2345, they are on same machine 

then I install Emby Android app on my mobile phone and configure server address: http://192.168.51.39:2345, and everything is ok

 

But after I restart Emby Android app, the server address has been changed to http://192.168.51.39:8098 automatically !! 

I want to know why the app change the server address?

It seems the app use the Nginx upstream address as the server address, am I make some mistakes in configuration ?

 

All the devices are in the same LAN

 

Arch: Emby Android -> Nginx ->  Emby Server

Emby server version:  4.8.0.54

Emby Andrord version:  3.3.39

 

========== Nginx Conf Begin =============

server{
    gzip on;
    listen 2345;
    listen [::]:2345;
    server_name default;
    ## The default `client_max_body_size` is 1M, this might not be enough for some posters, etc.
    client_max_body_size 20M;
    add_header 'Referrer-Policy' 'no-referrer';
    set $emby http://192.168.51.39:8098;  #emby/jellyfin address


    # Proxy sockets traffic for jellyfin-mpv-shim and webClient
    location ~ /(socket|embywebsocket) {
        # Proxy emby/jellyfin Websockets traffic
        proxy_pass $emby;
        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;
        proxy_set_header X-Forwarded-Protocol $scheme;
        proxy_set_header X-Forwarded-Host $http_host;
    }
    location ~* /web/index.html {
        proxy_buffering off;
        js_body_filter  addExternalUrl.incloudUrl buffer_type=string;
        proxy_pass $emby;
        proxy_pass_request_body off;
        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;
        proxy_set_header X-Forwarded-Protocol $scheme;
        proxy_set_header X-Forwarded-Host $http_host;
        proxy_set_header Accept-Encoding "identity";
        proxy_set_header X-Original-URI $request_uri;
        js_header_filter addExternalUrl.HeaderFilter;
    }
    location @backend {
        proxy_pass $emby;
    }

    ...
}

========== Nginx Conf Begin =============

Link to comment
Share on other sites

rbjtech

So I believe the App is likely doing a broadcast (on the same LAN) when it starts (I'm not sure..) - and is 'finding' the server directly - thus bypassing the proxy.

We would need the Dev's to confirm this theory.

To force it to use the proxy - maybe block incoming traffic on the emby host and only allow it from the proxy ?

Link to comment
Share on other sites

4 hours ago, rbjtech said:

So I believe the App is likely doing a broadcast (on the same LAN) when it starts (I'm not sure..) - and is 'finding' the server directly - thus bypassing the proxy.

We would need the Dev's to confirm this theory.

To force it to use the proxy - maybe block incoming traffic on the emby host and only allow it from the proxy ?

That is correct.

  • Thanks 1
Link to comment
Share on other sites

7 hours ago, david_666 said:

thank for your quick reply, i know how to solve it~

Just curious, what is the solution?

Link to comment
Share on other sites

david_666
On 10/21/2023 at 8:43 AM, Luke said:

Just curious, what is the solution?

lol, very simple, i block the port 8098 in firewall config of my windows server

  • Like 1
Link to comment
Share on other sites

rbjtech
2 hours ago, david_666 said:

lol, very simple, i block the port 8098 in firewall config of my windows server

On 20/10/2023 at 10:09, rbjtech said:

To force it to use the proxy - maybe block incoming traffic on the emby host and only allow it from the proxy ?

As I said above, blocking the traffic is a sure way of forcing the issue :)

You could block the tcp 8098 - you could also block the udp 1900

Link to comment
Share on other sites

hjason7812
On 10/20/2023 at 3:34 AM, david_666 said:

I have a Emby server on Windows with port 8098 and a Nginx server before it with port 2345, they are on same machine 

then I install Emby Android app on my mobile phone and configure server address: http://192.168.51.39:2345, and everything is ok

 

But after I restart Emby Android app, the server address has been changed to http://192.168.51.39:8098 automatically !! 

I want to know why the app change the server address?

It seems the app use the Nginx upstream address as the server address, am I make some mistakes in configuration ?

 

All the devices are in the same LAN

 

Arch: Emby Android -> Nginx ->  Emby Server

Emby server version:  4.8.0.54

Emby Andrord version:  3.3.39

 

========== Nginx Conf Begin =============

server{
    gzip on;
    listen 2345;
    listen [::]:2345;
    server_name default;
    ## The default `client_max_body_size` is 1M, this might not be enough for some posters, etc.
    client_max_body_size 20M;
    add_header 'Referrer-Policy' 'no-referrer';
    set $emby http://192.168.51.39:8098;  #emby/jellyfin address


    # Proxy sockets traffic for jellyfin-mpv-shim and webClient
    location ~ /(socket|embywebsocket) {
        # Proxy emby/jellyfin Websockets traffic
        proxy_pass $emby;
        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;
        proxy_set_header X-Forwarded-Protocol $scheme;
        proxy_set_header X-Forwarded-Host $http_host;
    }
    location ~* /web/index.html {
        proxy_buffering off;
        js_body_filter  addExternalUrl.incloudUrl buffer_type=string;
        proxy_pass $emby;
        proxy_pass_request_body off;
        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;
        proxy_set_header X-Forwarded-Protocol $scheme;
        proxy_set_header X-Forwarded-Host $http_host;
        proxy_set_header Accept-Encoding "identity";
        proxy_set_header X-Original-URI $request_uri;
        js_header_filter addExternalUrl.HeaderFilter;
    }
    location @backend {
        proxy_pass $emby;
    }

    ...
}

========== Nginx Conf Begin =============

Seems like you didn't save the server address when you changed it. That's why it changed back to the default server address. 

Link to comment
Share on other sites

rbjtech
3 hours ago, hjason7812 said:

Seems like you didn't save the server address when you changed it. That's why it changed back to the default server address. 

Pls see above, it has nothing to do with 'saving'...

Link to comment
Share on other sites

hjason7812
1 hour ago, rbjtech said:

Pls see above, it has nothing to do with 'saving'...

I did read above ot looks like you didn't save or you did and it didn't take. I have done thay before and thought something was wrong with the server too. 

Link to comment
Share on other sites

rbjtech
6 hours ago, hjason7812 said:

I did read above ot looks like you didn't save or you did and it didn't take. I have done thay before and thought something was wrong with the server too. 

With an App - you don't manually 'save' anything - you just connect to the service and next time it will use that same connection.

However, BEFORE that connection prompt even displays, the App does a network broadcast - and if the connection exists, and has a previous authenticated connection, it will use that instead.  ie it will ignore any proxy connection.     This is what the OP is referring to - and has solved by blocking the 'direct' connection.    It has nothing to do with 'saving' the connection.

Edited by rbjtech
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...