Jump to content

Not playing video through Nginx reverse proxy


ACoolUsername
 Share

Recommended Posts

ACoolUsername

Hey,

 

I have emby installed using the docker and behind an nginx reverse proxy, I used the config from this post https://emby.media/community/index.php?/topic/47508-how-to-nginx-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 post-264603-0-55382000-1513758703_thumb.png. 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
Link to comment
Share on other sites

thatoneguy99

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!

Link to comment
Share on other sites

henryford

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

×
×
  • Create New...