apache Firefox 检测到服务器正在以永远无法完成的方式重定向对该地址的请求

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1547813/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 18:14:37  来源:igfitidea点击:

Firefox has detected that the server is redirecting the request for this address in a way that will never complete

javaapachegrailsgroovy

提问by MrBliz

I'm following Scott Davis' tutorialson developing grails apps, but whenever i try to run my app (or indeed his source code) i get "Firefox has detected that the server is redirecting the request for this address in a way that will never complete." Safari gives a similar error message as does Opera.

我正在关注 Scott Davis 关于开发 grails 应用程序的 教程,但是每当我尝试运行我的应用程序(或实际上是他的源代码)时,我都会收到“Firefox 检测到服务器正在以永远不会的方式重定向对该地址的请求完全的。” Safari 提供与 Opera 类似的错误消息。

As i've tested the original authors source code which gives the same error i'm fairly confident it's nothing to do with the code.

因为我已经测试了原始作者的源代码,它给出了同样的错误,我相当有信心它与代码无关。

Is this a problem with the web server on my machine? I use Mac OS Snow Leopard so i'm assuming it's apache that's generating this error.

这是我机器上的网络服务器的问题吗?我使用 Mac OS Snow Leopard,所以我假设是 apache 产生了这个错误。

Edit: Seems Grails as standard uses Jetty, so probably not Apache that is causing the problem. However also tested the app on Glassfish and i get the same error.

编辑:似乎 Grails 作为标准使用 Jetty,所以可能不是导致问题的 Apache。但是也在 Glassfish 上测试了该应用程序,我得到了同样的错误。

Anyone know what i can do to fix this?

有谁知道我能做些什么来解决这个问题?

Cheers

干杯

采纳答案by Nenad

Just carefully check your URLMappings configuration:

只需仔细检查您的 URLMappings 配置:

YOUR_APP/grails-app/conf/UrlMappings.groovy

YOUR_APP/grails-app/conf/UrlMappings.groovy

Common case:

常见情况:

You configured request to be handled like this:

您将请求配置为如下处理:

"/anything" (controller:"someController")

“/anything”(控制器:“someController”)

So without action, request will be handled by default one, "index". "index" action usually redirects to "list", and "list", in some cases redirect back to "index"

所以如果不采取行动,请求将默认处理一个,“索引”。“索引”动作通常重定向到“列表”,而“列表”,在某些情况下重定向回“索引”

There is your loop.

有你的循环。

Good luck

祝你好运

回答by Ferdinand Beyer

It depends on the code and Apache configuration you are using. I assume that the web server sends cyclic HTTP redirections, eg. from /root/to /root(without the slash) and vice versa. This causes a redirection infinite loop.

这取决于您使用的代码和 Apache 配置。我假设 Web 服务器发送循环 HTTP 重定向,例如。from /root/to /root(不带斜线),反之亦然。这会导致重定向无限循环。

Check your configuration on conditions that cause a HTTP redirect. For example, Apache automatically adds slashes to directory URLs in standard configuration (like the /root/example above). I don't know Grails, so I cannot give you a hint on how URLs are processed within the app.

在导致 HTTP 重定向的条件下检查您的配置。例如,Apache 会在标准配置中自动向目录 URL 添加斜杠(如/root/上面的示例)。我不了解 Grails,因此我无法就应用程序中如何处理 URL 向您提供提示。

You can also use manual HTTP requests for debugging to see whats going on behind the scenes, using telneton a terminal:

您还可以使用手动 HTTP 请求进行调试以查看幕后发生的事情,telnet在终端上使用:

$ telnet localhost 80
GET / HTTP/1.0

I guess the response will be something like that:

我想回应会是这样的:

HTTP/1.0 302 Found
Location: XXX
...

Now do a second request on the URL passed in the Locationheader and so on.

现在对在Location标头中传递的 URL 执行第二个请求,依此类推。

回答by Cal S

I was getting the same error a little while ago, heres how I fixed:

不久前我遇到了同样的错误,这是我修复的方法:

  1. Try the same page on a different internet setup (it could be your ISP)
  2. Open up Safari, Firefox or whatever your using and empty the cache and delete ALL your cookies
  3. Reboot your computer and try again
  1. 在不同的 Internet 设置上尝试相同的页面(可能是您的 ISP)
  2. 打开 Safari、Firefox 或任何您使用的工具并清空缓存并删除所有 cookie
  3. 重新启动计算机并重试

It may work now, but if it doesn't:

它现在可能有效,但如果无效:

  1. open up Firefox and type 'about:config' (without the quotes) into the URL bar
  2. You will get some little warning, just press OK
  3. Type 'redirect' into the Filter box
  4. You should see a listing for 'network.http.redirection-limit'
  5. Double click the listing and type a large number (anything above 50 and lower than 200)
  6. Press OK, quit and re-open FireFox
  1. 打开 Firefox 并在 URL 栏中输入“about:config”(不带引号)
  2. 您会收到一些警告,只需按 OK
  3. 在过滤器框中输入“重定向”
  4. 您应该会看到“network.http.redirection-limit”的列表
  5. 双击列表并输入一个大数字(大于 50 小于 200)
  6. 按确定,退出并重新打开 FireFox

Basically all that does is make FireFox's tolerance for redirect loops higher which should fix your problem - but usually, just borrowing someone else's internet connection fixes it

基本上所有所做的都是使 FireFox 对重定向循环的容忍度更高,这应该可以解决您的问题 - 但通常,只需借用其他人的互联网连接即可解决问题

Hope that all helps =)

希望对大家有帮助=)