Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

访问指定目录时 301 重定向到源站端口是什么原因 #419

Answered by Lorna0
chettestwef asked this question in Q&A
Discussion options

问题描述

在访问指定目录:/myExp,/AddExp时,出现301错误,并且在更新了waf后无法恢复,以下是waf设置,相关证据,访问路径
image
image
image
image

复现方法

由于此问题的独立性,此问题貌似仅能在我的服务器上复现

期望的结果

修复此问题

You must be logged in to vote

又有人遇到这个问题了,附一个解决方案,实际还是要改上游的 nginx,跟雷池无关:https://segmentfault.com/a/1190000020521708

Replies: 3 comments 2 replies

Comment options

我是不理解,我以为是我的php写的有问题,他怎么能301跳转呢,我排查了半个小时发现此问题出在waf上

You must be logged in to vote
0 replies
Comment options

我好想知道问题所在了,我的源url是:
http://slaspi.xxxxxx.cn:3656/Event/addEscape/FacilityGuard-Escape?userid=xxxxxxxxx@steamscape=1
请看?号前面并没有 / 所以,nginx会尝试通过301修正此url为:
http://slaspi.xxxxxx.cn:3658/Event/addEscape/FacilityGuard-Escape/?userid=xxxxxxxxx@steamscape=1
但上述修正恰恰返回到了源站

You must be logged in to vote
0 replies
Comment options

非预期的 301 重定向基本都是后端服务的逻辑,和 waf 无关。最常见的是 nginx 自动添加 / ,还有一种是填错协议结果后台 http 301 到 https。

问题似乎解决了,issue 关闭。

You must be logged in to vote
2 replies
Comment options

为方便大家排查,转成 discussion 〜

Comment options

又有人遇到这个问题了,附一个解决方案,实际还是要改上游的 nginx,跟雷池无关:https://segmentfault.com/a/1190000020521708

Answer selected by Lorna0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
Converted from issue

This discussion was converted from issue #321 on October 31, 2023 09:01.

AltStyle によって変換されたページ (->オリジナル) /