RSSHub icon indicating copy to clipboard operation
RSSHub copied to clipboard

不能反向代理子目录访问RSSHub

Open Aermisty opened this issue 5 years ago • 3 comments

预期是什么

RSSHub 访问路径使用域名的子目录,例如 https://example.com/rsshub/ 而不是 https://rsshub.example.com/

实际发生了什么

提示 wrong path (报错信息见额外信息)

部署相关信息

Env Value
OS Debian GNU/Linux 10 x86_64(Py3.7.8)
Node version v14.17.6
if Docker, version 18.09.1, build 4c52b90
  • 额外信息(日志、报错等)

设置子目录的反向代理后,报错如下

Route requested: /rsshub/
Error message: wrong path
Helpful Information to provide when opening issue: 
Path: /rsshub/
Node version: v14.17.6

Nginx 反向代理设置如下:

location /rsshub/
{
    proxy_pass http://localhost:1200;
    proxy_set_header Host localhost;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header REMOTE-HOST $remote_addr;
    
    add_header X-Cache $upstream_cache_status;
    add_header Cache-Control no-cache;
}

Aermisty avatar Sep 24 '21 15:09 Aermisty

👍 感谢提交该 Issue,请确保仔细阅读 Issue 模板,RSS 提案模板 或 Feature 提案模板 以便于测试。不符合模板将导致 Issue 被直接关闭。

👍 Thanks for the issue, please follow the Issue template, RSS proposal template or Feature proposal template. Otherwise the issue will be closed.

github-actions[bot] avatar Sep 24 '21 15:09 github-actions[bot]

leirock 你好。 我通过修改 nginx配置复现,并且解决了你的问题。 修改后的 nginx配置:

location /rsshub/
{
    proxy_pass http://localhost:1200/;
    proxy_set_header Host localhost;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header REMOTE-HOST $remote_addr;
    
    add_header X-Cache $upstream_cache_status;
    add_header Cache-Control no-cache;
}

区别在于第三行的 proxy_pass 。

kaiili avatar Sep 26 '21 10:09 kaiili

@kaiili 谢谢,刚刚测试了,这样的配置能够解决问题。

Aermisty avatar Sep 26 '21 11:09 Aermisty