Static resources not loaded behind nginx reverse proxy
See original GitHub issueHi,
I have an issue which may be related to #54 or #96. When using a nginx reverse proxy (using your Docker image), static resources are not loaded, so the webpage looks like this:
I get no error in the console, but the only request the browser does are for the main html file and favicon.ico. So I assume the issue may have to do with headers. When accessing the service directly, it works fine. I tried using Vivaldi and Firefox, and disabling my adblocker.
My nginx configuration (I tried removing the proxy_set_header lines, did not change anything):
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name download.domainname.tld;
ssl_certificate /etc/letsencrypt/live/default/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/default/privkey.pem;
access_log /var/log/nginx/youtubedl.access.log compression_logging;
error_log /var/log/nginx/youtubedl.error.log;
# This is the internal Docker DNS, cache only for 30s
# Required to set define upstreams with variables
# See https://sandro-keil.de/blog/let-nginx-start-if-upstream-host-is-unavailable-or-down/
resolver 127.0.0.11 valid=30s;
location / {
set $upstream http://container_name:80;
proxy_pass $upstream;
proxy_redirect $upstream https://download.domainname.tld;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Host $server_name:$server_port;
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;
}
}
And the headers:
>> curl https://download.domainname.tld -I HTTP/2 200 server: nginx/1.17.8 date: Thu, 11 Jun 2020 07:53:54 GMT x-powered-by: Express access-control-allow-headers: Origin, X-Requested-With, Content-Type, Accept, Authorization access-control-allow-origin: https://download.domainname.tld strict-transport-security: max-age=63072000; includeSubdomains; x-frame-options: sameorigin x-content-type-options: nosniff x-xss-protection: 1; mode=block
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (2 by maintainers)
Okay, so this issue was resolved by tweaking nginx config:
add_header Access-Control-Allow-Origin *;
, which is not very good security-wiseadd_header X-Content-Type-Options nosniff;
(thanks to #96)However, these steps should not be necessary. Moreover, judging by #96, many people have that kind of issues.
Why not include a nginx server in the Docker image instead of using Node? That would probably resolve everything.
Coming just from issue #122 and hence looking at the whole web-server topic here again and seeing how it seems to help people with performance I’m curious if we could target looking into this for a 4.5 milestone, @Tzahi12345?