Discussion:
301 infinite redirect
floydbrush
2013-07-01 12:46:05 UTC
Permalink
Hi,

I need to made a 301 redirect from one url to another. So i tried to use:

$this->redirect($newUrl, 301);

The redirect works first time, but is infinite and throws
ERR_TOO_MANY_REDIRECTS, so Search Engines bots can't index the new url.

I checked the headers and I don't understand why the hell not stops once
the redirect is made after first 301. Example:
http://urivalet.com/?http://www.pasteleria.com/noticias/view/el-chocolate-ya-se-consumia-en-el-1150-a-c/179#Report

I started a "clean" cakephp app for try if there's a problem with my
current app, and the behaviour is the same.

If I use redirect 302 instead of 301, the redirect works fine (or 303, 307,
404...). Only causes a loop with 301.

I have no idea what is happening. Any tips?
--
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-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To post to this group, send email to cake-php-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
AD7six
2013-07-01 13:09:16 UTC
Permalink
The easiest way to debug redirect problems is to put:

public function redirect($url) {
debug($url);
debug(Debugger::trace());
die;
}

OR

public function redirect($url) {
$this->log($this->here);
$this->log($url);
$this->log(Debugger::trace());
parent::redirect($url);
}

Or similar, In your app controller, and determine why/how/what causes the
problem url to redirect to itself.

AD
Post by floydbrush
Hi,
$this->redirect($newUrl, 301);
The redirect works first time, but is infinite and throws
ERR_TOO_MANY_REDIRECTS, so Search Engines bots can't index the new url.
I checked the headers and I don't understand why the hell not stops once
http://urivalet.com/?http://www.pasteleria.com/noticias/view/el-chocolate-ya-se-consumia-en-el-1150-a-c/179#Report
I started a "clean" cakephp app for try if there's a problem with my
current app, and the behaviour is the same.
If I use redirect 302 instead of 301, the redirect works fine (or 303,
307, 404...). Only causes a loop with 301.
I have no idea what is happening. Any tips?
--
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-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To post to this group, send email to cake-php-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
floydbrush
2013-07-01 16:27:28 UTC
Permalink
Hi AD,

thanks for the help. I'm still trying to solve this problem.

If I use a redirect 301 from /testnews/test to testredirect/test with
$this->redirect(array('controller' => 'testredirect', 'action' => 'test'),
301);

I get this headers:

*1. REQUESTING: http://www.pasteleria.com/testnews/test*
GET /testnews/test HTTP/1.1
Accept: */*
Accept-Encoding: gzip
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Accept-Language: en-us,en;q=0.5
User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/27.0.1453.116 Safari/537.36
Host: www.pasteleria.com
Connection: Keep-Alive
*SERVER RESPONSE: 301 Moved Permanently*
Date: Mon, 01 Jul 2013 16:16:18 GMT
Server: Apache
X-Powered-By: PHP/5.3.2-1ubuntu4.17
Location: http://www.pasteleria.com/testredirect/test
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 20
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/html; charset="UTF-8"
Redirecting to http://www.pasteleria.com/testredirect/test ...
*2. REQUESTING: http://www.pasteleria.com/testredirect/test*
GET /testredirect/test HTTP/1.1
Accept: */*
Accept-Encoding: gzip
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Accept-Language: en-us,en;q=0.5
User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/27.0.1453.116 Safari/537.36
Host: www.pasteleria.com
Connection: Keep-Alive
*SERVER RESPONSE: 301 Moved Permanently*
Date: Mon, 01 Jul 2013 16:16:18 GMT
Server: Apache
Location: http://www.pasteleria.com/testredirect/test
Vary: Accept-Encoding
Content-Encoding: gzip
X-Powered-By: PHP/5.3.2-1ubuntu4.17
Age: 0
Content-Length: 20
Keep-Alive: timeout=15, max=99
Connection: Keep-Alive
Content-Type: text/html; charset="UTF-8"
Redirecting to http://www.pasteleria.com/testredirect/test ...


And so on...

So, logging I can not find the problem.

2013-07-01 18:16:18 Error: /testnews/test
2013-07-01 18:16:18 Error: 301
2013-07-01 18:16:18 Error: Array
(
[controller] => testredirect
[action] => test
)

2013-07-01 18:16:18 Error: TestnewsController::redirect() -
APP/Controller/TestnewsController.php, line 29
TestnewsController::test() - APP/Controller/TestnewsController.php, line 13
ReflectionMethod::invokeArgs() - [internal], line ??
Controller::invokeAction() - CORE/Cake/Controller/Controller.php, line 486
Dispatcher::_invoke() - CORE/Cake/Routing/Dispatcher.php, line 187
Dispatcher::dispatch() - CORE/Cake/Routing/Dispatcher.php, line 162
[main] - APP/webroot/index.php, line 96


The only one thing I detected is that a log message placed inside
AppController::beforeFilter() is never written to the log for
/testredirect/test (the destination page, that starts the loop).

With 302 redirect works well, this behaviour only happens with 301. Could
it be a bug?
Post by AD7six
public function redirect($url) {
debug($url);
debug(Debugger::trace());
die;
}
OR
public function redirect($url) {
$this->log($this->here);
$this->log($url);
$this->log(Debugger::trace());
parent::redirect($url);
}
Or similar, In your app controller, and determine why/how/what causes the
problem url to redirect to itself.
AD
Post by floydbrush
Hi,
$this->redirect($newUrl, 301);
The redirect works first time, but is infinite and throws
ERR_TOO_MANY_REDIRECTS, so Search Engines bots can't index the new url.
I checked the headers and I don't understand why the hell not stops once
http://urivalet.com/?http://www.pasteleria.com/noticias/view/el-chocolate-ya-se-consumia-en-el-1150-a-c/179#Report
I started a "clean" cakephp app for try if there's a problem with my
current app, and the behaviour is the same.
If I use redirect 302 instead of 301, the redirect works fine (or 303,
307, 404...). Only causes a loop with 301.
I have no idea what is happening. Any tips?
--
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-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To post to this group, send email to cake-php-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
floydbrush
2013-07-01 16:31:56 UTC
Permalink
Hi AD,

thanks for the help. I'm still trying to solve this problem.

If I use a redirect 301 from /testnews/test to testredirect/test with
$this->redirect(array('controller' => 'testredirect', 'action' => 'test'),
301);

I get this headers:

*1. REQUESTING: http://www.pasteleria.com/testnews/test*
GET /testnews/test HTTP/1.1
Accept: */*
Accept-Encoding: gzip
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Accept-Language: en-us,en;q=0.5
User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/27.0.1453.116 Safari/537.36
Host: www.pasteleria.com
Connection: Keep-Alive
*SERVER RESPONSE: 301 Moved Permanently*
Date: Mon, 01 Jul 2013 16:16:18 GMT
Server: Apache
X-Powered-By: PHP/5.3.2-1ubuntu4.17
Location: http://www.pasteleria.com/testredirect/test
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 20
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/html; charset="UTF-8"
Redirecting to http://www.pasteleria.com/testredirect/test ...
*2. REQUESTING: http://www.pasteleria.com/testredirect/test*
GET /testredirect/test HTTP/1.1
Accept: */*
Accept-Encoding: gzip
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Accept-Language: en-us,en;q=0.5
User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/27.0.1453.116 Safari/537.36
Host: www.pasteleria.com
Connection: Keep-Alive
*SERVER RESPONSE: 301 Moved Permanently*
Date: Mon, 01 Jul 2013 16:16:18 GMT
Server: Apache
Location: http://www.pasteleria.com/testredirect/test
Vary: Accept-Encoding
Content-Encoding: gzip
X-Powered-By: PHP/5.3.2-1ubuntu4.17
Age: 0
Content-Length: 20
Keep-Alive: timeout=15, max=99
Connection: Keep-Alive
Content-Type: text/html; charset="UTF-8"
Redirecting to http://www.pasteleria.com/testredirect/test ...


And so on...

So, logging I can not find the problem.

2013-07-01 18:16:18 Error: /testnews/test
2013-07-01 18:16:18 Error: 301
2013-07-01 18:16:18 Error: Array
(
[controller] => testredirect
[action] => test
)

2013-07-01 18:16:18 Error: TestnewsController::redirect() -
APP/Controller/TestnewsController.php, line 29
TestnewsController::test() - APP/Controller/TestnewsController.php, line 13
ReflectionMethod::invokeArgs() - [internal], line ??
Controller::invokeAction() - CORE/Cake/Controller/Controller.php, line 486
Dispatcher::_invoke() - CORE/Cake/Routing/Dispatcher.php, line 187
Dispatcher::dispatch() - CORE/Cake/Routing/Dispatcher.php, line 162
[main] - APP/webroot/index.php, line 96


The only one thing I detected is that a log message placed inside
AppController::beforeFilter() is never written to the log for
/testredirect/test (the destination page, that starts the loop).

With 302 redirect works well, this behaviour only happens with 301. Could
it be a bug?

Thanks a lot for your time!

Albert
Post by AD7six
public function redirect($url) {
debug($url);
debug(Debugger::trace());
die;
}
OR
public function redirect($url) {
$this->log($this->here);
$this->log($url);
$this->log(Debugger::trace());
parent::redirect($url);
}
Or similar, In your app controller, and determine why/how/what causes the
problem url to redirect to itself.
AD
Post by floydbrush
Hi,
$this->redirect($newUrl, 301);
The redirect works first time, but is infinite and throws
ERR_TOO_MANY_REDIRECTS, so Search Engines bots can't index the new url.
I checked the headers and I don't understand why the hell not stops once
http://urivalet.com/?http://www.pasteleria.com/noticias/view/el-chocolate-ya-se-consumia-en-el-1150-a-c/179#Report
I started a "clean" cakephp app for try if there's a problem with my
current app, and the behaviour is the same.
If I use redirect 302 instead of 301, the redirect works fine (or 303,
307, 404...). Only causes a loop with 301.
I have no idea what is happening. Any tips?
--
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-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To post to this group, send email to cake-php-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
AD7six
2013-07-01 17:07:25 UTC
Permalink
Post by floydbrush
Hi AD,
thanks for the help. I'm still trying to solve this problem.
If I use a redirect 301 from /testnews/test to testredirect/test with
$this->redirect(array('controller' => 'testredirect', 'action' => 'test'),
301);
*1. REQUESTING: http://www.pasteleria.com/testnews/test*
GET /testnews/test HTTP/1.1
Accept: */*
Accept-Encoding: gzip
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Accept-Language: en-us,en;q=0.5
User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/27.0.1453.116 Safari/537.36
Host: www.pasteleria.com
Connection: Keep-Alive
*SERVER RESPONSE: 301 Moved Permanently*
Date: Mon, 01 Jul 2013 16:16:18 GMT
Server: Apache
X-Powered-By: PHP/5.3.2-1ubuntu4.17
Location: http://www.pasteleria.com/testredirect/test
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 20
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/html; charset="UTF-8"
Redirecting to http://www.pasteleria.com/testredirect/test ...
*2. REQUESTING: http://www.pasteleria.com/testredirect/test*
GET /testredirect/test HTTP/1.1
Accept: */*
Accept-Encoding: gzip
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Accept-Language: en-us,en;q=0.5
User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/27.0.1453.116 Safari/537.36
Host: www.pasteleria.com
Connection: Keep-Alive
*SERVER RESPONSE: 301 Moved Permanently*
Date: Mon, 01 Jul 2013 16:16:18 GMT
Server: Apache
Location: http://www.pasteleria.com/testredirect/test
Vary: Accept-Encoding
Content-Encoding: gzip
X-Powered-By: PHP/5.3.2-1ubuntu4.17
Age: 0
Content-Length: 20
Keep-Alive: timeout=15, max=99
Connection: Keep-Alive
Content-Type: text/html; charset="UTF-8"
Redirecting to http://www.pasteleria.com/testredirect/test ...
And so on...
So, logging I can not find the problem.
2013-07-01 18:16:18 Error: /testnews/test
Where is the debug output for the url "/testredirect/test"

?
--
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-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To post to this group, send email to cake-php-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
floydbrush
2013-07-01 18:57:04 UTC
Permalink
Sorry, I tried to explain but my "spanish" english is bad :/

What I wanted yo say is that not exists that information, seems like is not
executed redirect in the loop. Anyway, I have a log message in
AppController::beforeFilter() that neither appears for "/testredirect/test".

All my log information for the case is:

2013-07-01 20:50:28 Error: Inside AppController::beforeFilter().
$this->here: /testnews/test
2013-07-01 20:50:29 Error: $here: /testnews/test
2013-07-01 20:50:29 Error: $status: 301
2013-07-01 20:50:29 Error: Array
(
[controller] => testredirect
[action] => test
)

2013-07-01 20:50:29 Error: AppController::redirect() -
APP/Controller/AppController.php, line 47
TestnewsController::test() - APP/Controller/TestnewsController.php, line 13
ReflectionMethod::invokeArgs() - [internal], line ??
Controller::invokeAction() - CORE/Cake/Controller/Controller.php, line 486
Dispatcher::_invoke() - CORE/Cake/Routing/Dispatcher.php, line 187
Dispatcher::dispatch() - CORE/Cake/Routing/Dispatcher.php, line 162
[main] - APP/webroot/index.php, line 96


And 301 loop with /testredirect/test (watching the headers) occurs like a
ghost :)

Albert
Post by AD7six
Post by floydbrush
Hi AD,
thanks for the help. I'm still trying to solve this problem.
If I use a redirect 301 from /testnews/test to testredirect/test with
$this->redirect(array('controller' => 'testredirect', 'action' => 'test'),
301);
*1. REQUESTING: http://www.pasteleria.com/testnews/test*
GET /testnews/test HTTP/1.1
Accept: */*
Accept-Encoding: gzip
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Accept-Language: en-us,en;q=0.5
User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/27.0.1453.116 Safari/537.36
Host: www.pasteleria.com
Connection: Keep-Alive
*SERVER RESPONSE: 301 Moved Permanently*
Date: Mon, 01 Jul 2013 16:16:18 GMT
Server: Apache
X-Powered-By: PHP/5.3.2-1ubuntu4.17
Location: http://www.pasteleria.com/testredirect/test
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 20
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/html; charset="UTF-8"
Redirecting to http://www.pasteleria.com/testredirect/test ...
*2. REQUESTING: http://www.pasteleria.com/testredirect/test*
GET /testredirect/test HTTP/1.1
Accept: */*
Accept-Encoding: gzip
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Accept-Language: en-us,en;q=0.5
User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/27.0.1453.116 Safari/537.36
Host: www.pasteleria.com
Connection: Keep-Alive
*SERVER RESPONSE: 301 Moved Permanently*
Date: Mon, 01 Jul 2013 16:16:18 GMT
Server: Apache
Location: http://www.pasteleria.com/testredirect/test
Vary: Accept-Encoding
Content-Encoding: gzip
X-Powered-By: PHP/5.3.2-1ubuntu4.17
Age: 0
Content-Length: 20
Keep-Alive: timeout=15, max=99
Connection: Keep-Alive
Content-Type: text/html; charset="UTF-8"
Redirecting to http://www.pasteleria.com/testredirect/test ...
And so on...
So, logging I can not find the problem.
2013-07-01 18:16:18 Error: /testnews/test
Where is the debug output for the url "/testredirect/test"
?
--
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-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To post to this group, send email to cake-php-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
AD7six
2013-07-01 19:36:54 UTC
Permalink
Post by floydbrush
Sorry, I tried to explain but my "spanish" english is bad :/
What I wanted yo say is that not exists that information, seems like is
not executed redirect in the loop.
If there's no log entry for Cake redirecting from /testredirected/test to
/testredirected/test, but your app IS redirecting like that - then either:

1) Your app isn't responsible for that redirect
2) Your app is responsible for the redirect but the thing responsible isn't
using the controller redirect method.

You need to identify how that redirect is being issued, the first step to
that is reproducing the problem which so far you're only doing indirectly
(not going to help/work). That means, quite simply, you need to
debug/experiment. Put stuff like this in your webroot/index.php:

<?php
if ($_GET['url'] === '/testredirected/test') {
echo "Forcing a headers-already-sent error";
}
...

And look at the stack trace when your app issues a redirect.

That's just an example - you need to do the leg work to find your logical
loop.

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-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To post to this group, send email to cake-php-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
floydbrush
2013-07-02 20:19:54 UTC
Permalink
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.

My question now is: Is it a cake problem or a server problem?

My doubt came for this reason: In local always works fine. But on online
server, with a only PHP file with the same headers that CakePHP set for a
redirect, any loop is created and there's no need to disable browser cache.
Only happens if the headers are set inside CakePHP code.

Albert
Post by AD7six
Post by floydbrush
Sorry, I tried to explain but my "spanish" english is bad :/
What I wanted yo say is that not exists that information, seems like is
not executed redirect in the loop.
If there's no log entry for Cake redirecting from /testredirected/test to
1) Your app isn't responsible for that redirect
2) Your app is responsible for the redirect but the thing responsible
isn't using the controller redirect method.
You need to identify how that redirect is being issued, the first step to
that is reproducing the problem which so far you're only doing indirectly
(not going to help/work). That means, quite simply, you need to
<?php
if ($_GET['url'] === '/testredirected/test') {
echo "Forcing a headers-already-sent error";
}
...
And look at the stack trace when your app issues a redirect.
That's just an example - you need to do the leg work to find your logical
loop.
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-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To post to this group, send email to cake-php-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
AD7six
2013-07-03 10:43:53 UTC
Permalink
Post by floydbrush
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
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-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To post to this group, send email to cake-php-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
Loading...