环境:
flatnas:docker compose部署,端口映射:8180:3000
nginx:开启http和虚拟目录反代
描述:
1、使用 host:8100 正常访问
2、nginx反代后,使用 https://url/dashboard则无法正常访问,只能加载背景等,其他都是404
错误描述:
1、nginx的反代写法,省略其他,其中url_flatnas已经定义为host:8100
location /dashboard/ { proxy_pass http://url_flatnas/; auth_basic_user_file /etc/nginx/conf.d/homepageauth; auth_basic "请登录!"; 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_hide_header X-Powered-By; proxy_hide_header Server; }
2、浏览器的开发者模式,会出现api、socket.io 等静态文件404 , 同时请求地址是https://url/api*******而不是https:/url/dashboard/api******
有可能是代码中使用了绝对地址而不是相对地址导致的?
环境:
flatnas:docker compose部署,端口映射:8180:3000
nginx:开启http和虚拟目录反代
描述:
1、使用 host:8100 正常访问
2、nginx反代后,使用 https://url/dashboard则无法正常访问,只能加载背景等,其他都是404
错误描述:
1、nginx的反代写法,省略其他,其中url_flatnas已经定义为host:8100
location /dashboard/ { proxy_pass http://url_flatnas/; auth_basic_user_file /etc/nginx/conf.d/homepageauth; auth_basic "请登录!"; 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_hide_header X-Powered-By; proxy_hide_header Server; }2、浏览器的开发者模式,会出现api、socket.io 等静态文件404 , 同时请求地址是https://url/api*******而不是https:/url/dashboard/api******
有可能是代码中使用了绝对地址而不是相对地址导致的?