Jump to content


Photo

Not playing video through Nginx reverse proxy

nginx docker reverse proxy ubuntu

  • Please log in to reply
2 replies to this topic

#1 ACoolUsername OFFLINE  

ACoolUsername

    Newbie

  • Members
  • 1 posts
  • Local time: 05:49 PM

Posted 20 December 2017 - 04:42 AM

Hey,

 

I have emby installed using the docker and behind an nginx reverse proxy, I used the config from this post https://emby.media/c...x-reverse-proxy. Shown below.

worker_processes  4;

events {
    worker_connections  8192;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    server_tokens off;

    sendfile        off;

    gzip on;
    gzip_disable "msie6";

    gzip_comp_level 6;
    gzip_min_length 1100;
    gzip_buffers 16 8k;
    gzip_proxied any;
    gzip_types
    text/plain
    text/css
    text/js
    text/xml
    text/javascript
    application/javascript
    application/x-javascript
    application/json
    application/xml
    application/rss+xml
    image/svg+xml;

    tcp_nodelay on;


    server_names_hash_bucket_size 128;
    map_hash_bucket_size 64;

    ## Start: Timeouts ##
    client_body_timeout   10;
    client_header_timeout 10;
    keepalive_timeout     30;
    send_timeout          10;
    keepalive_requests    10;
    ## End: Timeouts ##

    ## Default Listening ##

    server {
        listen 80 default_server;
        listen [::]:80 default_server;
        server_name _;
        return 301 https://$host$request_uri;
    }

    ##EMBY Server##

    server {
        listen [::]:443 ssl;
        listen 443 ssl;
        #listen 80;
        #listen [::]:80;

        server_name emby.mydomain.com;

        access_log /var/log/nginx/emby.mydomain.com-access.log;
        error_log /var/log/nginx/emby.mydomain.com-error.log;

        ssl_protocols TLSv1.2 TLSv1.1;
        ssl_certificate /etc/letsencrypt/live/emby.mydomain.com/cert.pem;
        ssl_certificate_key /etc/letsencrypt/live/emby.mydomain.com/privkey.pem;
        ssl_session_cache shared:SSL:10m;

        #add_header Public-Key-Pins '
        #pin-sha256="8TzXdhbnv+l6EjDG2Vj9EmgGiSmZenrTZSNUFEwyUE=";
        #pin-sha256="YLh1dUR9y6Kja30RrAn7JKnbQG/utLMkBgFF2Fuihg=";
        #pin-sha256="Vjs8r4z+80wjNcr1KepWQboSIRi63WsWXhIMN+eWys=";
        #max-age=86400; includeSubDomains';

        add_header X-Xss-Protection "1; mode=block" always;
        add_header X-Content-Type-Options "nosniff" always;
        add_header Strict-Transport-Security "max-age=2592000; includeSubdomains" always;
        add_header X-Frame-Options "SAMEORIGIN" always;
        proxy_hide_header X-Powered-By;
        add_header 'Referrer-Policy' 'no-referrer';
        add_header Content-Security-Policy "frame-ancestors mydomain.com emby.mydomain.com;";


        location / {
            proxy_pass http://localhost:8096;

            proxy_set_header Range $http_range;
            proxy_set_header If-Range $http_if_range;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header Host $host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

            #Next three lines allow websockets
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
        }
    }
}


I am able to access emby through the reverse proxy and can browse media and manage server but whenever I try to play videos it just shows a black screen and the loading icon and eventually an error message will appear Attached File  emby playback error.PNG   6.96KB   3 downloads. I have tested this with Chrome, Firefox, Edge and Opera and they all give the same result (Firefox and Edge show the poster and loading icon).

 

Everything works fine when connecting directly to emby (emby.mydomain.com:8904).

 

Any help would be much appreciated.


Edited by ACoolUsername, 20 December 2017 - 04:44 AM.


#2 thatoneguy99 OFFLINE  

thatoneguy99

    Advanced Member

  • Members
  • 334 posts
  • Local time: 11:49 PM
  • LocationVirginia

Posted 20 December 2017 - 04:51 AM

Your Emby port is set to 8904? But it looks like you still have 8096 set as the proxy pass in your nginx conf. See where I’m talking about? Unless there’s a typo somewhere I’m surprised you’re even able to access Emby at all.


Sent from my phone!

#3 henryford OFFLINE  

henryford

    Member

  • Members
  • 28 posts
  • Local time: 04:49 AM

Posted 20 December 2017 - 08:32 AM

Your Emby port is set to 8904? But it looks like you still have 8096 set as the proxy pass in your nginx conf. See where I’m talking about? Unless there’s a typo somewhere I’m surprised you’re even able to access Emby at all.


Sent from my phone!

 

That probably is only the public port, or the https port.

 

Since you can access emby, did you try it without your security settings? Comment them out, try again. If it works, enable them one by one to find the actual culprit (my guess would be somewhere around the frame-options).


Edited by henryford, 20 December 2017 - 08:32 AM.






Also tagged with one or more of these keywords: nginx, docker, reverse proxy, ubuntu

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users