Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

开启cdn无法访问管理面板的解决方法和问题所在 #838

Open
Sora39831 opened this issue Jan 2, 2024 · 0 comments
Open

开启cdn无法访问管理面板的解决方法和问题所在 #838

Sora39831 opened this issue Jan 2, 2024 · 0 comments

Comments

@Sora39831
Copy link

修改示例
原方法

location /admin {
            proxy_pass   http://localhost:81/;
        }
        location ~* ^/(static|common|auth|trojan)/ {
            proxy_pass  http://localhost:81;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "Upgrade";
            proxy_set_header Host $host;
        }

上面的方法在访问cdn站点时在浏览器开发者界面连对静态资源的请求都没有,不知道是不是proxy_set_header Host $host;没传递到cdn的问题

修改后

location / {
              proxy_pass  http://localhost:<面板端口>/;
              proxy_http_version 1.1;
              proxy_set_header Upgrade $http_upgrade;
              proxy_set_header Connection "Upgrade";
              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;
            }

修改后的缺点就是不能指定location的路径,因为(static|common|auth|trojan)这些资源文件的路径是写死了/static /common /auth /trojan,如果修改了location的路径比如/admin,就会请求不到这些资源文件导致白屏。

能力有限只能解决这么多了,如果作者大大可以完善一下这方面的逻辑就更好了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant