环境
Unraid: 6.8.2
Swag: 1.16.0
Jackett: v0.18.686
背景
- 通过域名和port(非80或443)转发,从外网访问unraid上的服务。
- Jackett转发配置用的swag里默认的nginx subdomain模板,仅修改了Server name。
问题
外网访问jackett (例如https://domain.com:7373/jackett/UI/Dashboard
)时,url会被重定向到 https://domain.com/jackett/UI/Login?ReturnUrl=%2Fjackett%2FUI%2FDashboard
,如此一来,原来的port被丢弃,转发失败。
解决
参考 https://github.com/Jackett/Jackett/issues/3643
- 修改nginx配置里的proxy.conf,路径:
swag的挂载目录\nginx\proxy.conf
将proxy_set_header X-Forwarded-Host $host;
改为proxy_set_header X-Forwarded-Host $http_host;
- 重启Swag即可
原因
https://github.com/Jackett/Jackett/issues/3643#issuecomment-415342024
using $http_host is highly recommended and needed for the download links to be build correctly if your nginx is running on a non default HTTP (80)/HTTPS (443) port (The $host variable never contains the original port while $http_host does).
网友评论