开发者

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

I'm following Scott Davis' tutorials on 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 redirect开发者_C百科ing the request for this address in a way that will never complete." Safari gives a similar error message as does 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.

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.

Anyone know what i can do to fix this?

Cheers


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.

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.

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

$ 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 Location header and so on.


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

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

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

Hope that all helps =)


Just carefully check your URLMappings configuration:

YOUR_APP/grails-app/conf/UrlMappings.groovy

Common case:

You configured request to be handled like this:

"/anything" (controller:"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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜