尝试加载 URL 时发生太多重定向 <-- 没有任何重定向

发布于 2024-12-09 16:50:52 字数 791 浏览 0 评论 0 原文

代码:

Jsoup.connect("http://www.warriorforum.com/").followRedirects(true).get();

记录猫错误:

10-14 11:58:08.593: ERROR/MY(24780): TRY1: download failed java.io.IOException: Too many redirects occurred trying to load URL http://www.warriorforum.com/

正如您在 Jsoup 连接类 当重定向计数超过 private Response(Response previousResponse) throws IOException 时抛出异常代码>私有静态最终int MAX_REDIRECTS = 20;

大约 12 小时前工作正常,但主机端发生了一些变化,我不知道是什么。使用浏览器查看网址时,似乎没有任何重定向。是什么导致了这个错误?

编辑 - 使用 Jsoup.connect(url).get() 访问子论坛和主题可以正常工作,但不能访问主页。

Code:

Jsoup.connect("http://www.warriorforum.com/").followRedirects(true).get();

Log cat error:

10-14 11:58:08.593: ERROR/MY(24780): TRY1: download failed java.io.IOException: Too many redirects occurred trying to load URL http://www.warriorforum.com/

As you can see in Jsoup Connection class the exception is thrown in private Response(Response previousResponse) throws IOException when redirect count exceeds private static final int MAX_REDIRECTS = 20;

Worked about 12h ago fine, but something has changed on the host side and I can't figure out what. When viewing the url with browser, there doesn't seem to be any redirects. What is causing this error?

EDIT - accessing subforums and topics with Jsoup.connect(url).get() is working, but not the main page.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

夏有森光若流苏 2024-12-16 16:50:52

如果我在浏览器 (Chrome) 中打开该 URL,我会收到“此网页有重定向循环”。它使用 301 响应以及与新位置完全相同的 URL (http://www.warriorforum.com/)。

也许该网站仍然缓存在浏览器中?也许重定向取决于客户端的具体情况(如语言、国家/地区、浏览器……)?

If I open the URL in my browser (Chrome), I get "This webpage has a redirect loop". It responds with a 301 and the very same URL as the new Location (http://www.warriorforum.com/).

Maybe the website is still cached in the browser? Maybe the redirect depends on client specifics (like language, country, browser, ...)?

献世佛 2024-12-16 16:50:52

使用 WireShark 拍摄发生情况的快照/跟踪,然后您可以将其发送给网站管理员以供他们查看调试。

Use WireShark to take a snapshot/trace of when it happens, then you can send it to the admins of the site for them to debug.

猫腻 2024-12-16 16:50:52

我也遇到了同样的问题,并且我通过各种方式寻找来源来解决这个问题。
因此,阅读其他人抱怨类似的问题时,我已经弄清楚了(自作聪明),这里适合任何喜欢太多意见的人。
由于该问题显然是一个循环问题,因此它与网站请求和浏览器的缓存(可能是身份验证会话)有关。
就我而言,没有内部(网站)路由器(重写或类似情况)并通过扩展请求来解决它。否则,清理浏览器缓存可能会解决该问题,否则会清理与该域相关的所有 cookie(会话)。不介意检查其他浏览器是否可用。如果不同的浏览器有相同的问题,并且您的缓存是干净的(如...)并且网页请求是干净的(标头 POST/GET/PUT ctr),那么它就超出了您的控制范围。放弃吧。
检查其他网页。那里是一片广阔的田野。
PS 早上好,stackoverflowers!

I had the same issue and as all ways I came to source to figure it out.
So reading others complain about similar issues I've figure it out (smart ass) and here it is for anyone likes too many opinions.
As the issue is clearly a loop issue, it has to do with the web site request and your browser's cache (authentication session perhaps).
In my case there was no internal (website ) router (rewrites or similar case) and solve it by scale the request. Otherwise a clean browsers cache might solve the issue otherwise clean all cookies (session) that related to this domain. Doesn't heart to check with other browsers if available. If different browsers have the same issue and your cache is clean (as...) and the web page request is clean (headers POST/GET/PUT ctr) then it's out of your hands. Give it up.
Check an other web page. It's a vast field out there.
P.S. Good morning stackoverflowers !!!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文