为啥这个网站使用宝塔只能反代首页?点其他的就回复到原站

2022-09-25 08:12:18 +08:00
 jsjcjsjc

我的配置是这样的,但是只能反代首页,点击其他链接就会恢复网址哈~

同时测试了几个其他网址,没问题哈

感谢

2523 次点击
所在节点    NGINX
11 条回复
jsjcjsjc
2022-09-25 08:55:39 +08:00
就这个网址 www.websiteplanet.com
zggsong
2022-09-25 09:26:09 +08:00
去研究一下这个 https://reflare.js.org/
o00o
2022-09-25 09:45:51 +08:00
求盗于路?
xilou31
2022-09-25 11:16:04 +08:00
没用过宝塔,但是你这个像是只反代了 url ,没有反代网址后的 uri
placeholder
2022-09-25 13:16:34 +08:00
不是,网页里用 a 标签写死的 href 也能反代吗?
lcy630409
2022-09-25 14:02:48 +08:00
点那个高级功能,“代理目录”填 /
jsjcjsjc
2022-09-25 17:23:19 +08:00
@lcy630409 感谢恢复
好像也不行哈~~
treblex
2022-09-25 19:11:04 +08:00
因为他 a 标签都是写的完整路径,包含了域名的
用 php curl 之后替换部分内容输出似乎是可以的
jsjcjsjc
2022-09-25 19:32:19 +08:00
@treblex nginx 无解吗?
Ch3n4y
2022-09-25 21:09:53 +08:00
发送域名改为$host 试试
jsjcjsjc
2022-09-26 19:45:20 +08:00
搞定
```
location / {
proxy_ssl_name www.websiteplanet.com;
proxy_ssl_server_name on;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_comp_level 5;
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary off;
proxy_redirect off;
proxy_set_header Host www.websiteplanet.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass https://www.websiteplanet.com;
proxy_set_header Accept-Encoding "";
sub_filter 'websiteplanet.com' 'websiteplanet.org';
sub_filter_types text/xml;
sub_filter_once off;
}
```

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/882719

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX