Wednesday, July 3, 2013

Re: 301 infinite redirect



On Tuesday, 2 July 2013 22:19:54 UTC+2, floydbrush wrote:
Hi AD,

after one complete day of debug/experiment without success, I noticed that attribute Age: 0 appears at the second Server Response of the loop.

Searching for the specification of the Age header field, I suspect the presence of the header field Age: 0 maybe means that the response is sent by intermediate cache from the server.

So I added in the send() function on lib/Network/CakeResponse.php (I know it's probably a bad idea, but it's only for discover the problem) this:

if ($this->_status === 301) {
           $this->_sendHeader("Cache-Control: no-store, private, no-cache, must-revalidate");
           $this->_sendHeader("Cache-Control: pre-check=0, post-check=0, max-age=0, max-stale = 0");
}

And now the server response after redirect is 200 and everything works well.

 
> Is it a cake problem or a server problem?
> In local always works fine

These two things _probably_ mean it's install/server specific. 

You mention "maybe means that the response is sent by intermediate cache from the server" - Cake isn't this intermediate cache (what's that?). As such the problem is outside the scope of CakePHP (assuming you've debugged appropriately, you've shown that the redirect isn't emitted by php at all), the thing issuing the redirect in a loop is the problem and that's not Cake and apparently not php either - it's your webserver/varnish/something else.

AD

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: