[Agavi-Users] Remove Pragma http-header

157 views
Skip to first unread message

Michal Charemza

unread,
Oct 19, 2009, 8:57:40 AM10/19/09
to Agavi Users Mailing List
Hi,

I'm trying to make sure that certain views *are* cached (in the
browser / proxies), so I'm setting the cache-control, expires headers
appropriately. I'm also trying to prevent the "Pragma" http header
from being sent. In a view the following does not seem to have an
effect:

$this->getResponse()->removeHttpHeader('Pragma');

However the following does seem to remove the header (according to
Firebug)

$this->getResponse()->setHttpHeader('Pragma', '');

Can I check that doing the latter is ok, and will suffer not bad
consequences?

Michal.

_______________________________________________
users mailing list
us...@lists.agavi.org
http://lists.agavi.org/mailman/listinfo/users

Felix Gilcher

unread,
Oct 20, 2009, 6:05:57 AM10/20/09
to Agavi Users Mailing List
Hi Michal,

This code

> $this->getResponse()->removeHttpHeader('Pragma');

does not remove the Pragma Header since this header is set by php
itself (most probably by session_start() in your case) and thus is not
managed by agavi.

This code

> $this->getResponse()->setHttpHeader('Pragma', '');

Overwrites the header set by php with an empty value. It should not
have any side effects. You can use curl or any other low level http
lib to check whether the header is really removed.

felix

--
Felix Gilcher

Bitextender GmbH
Paul-Heyse-Str. 6
D-80336 München

T: +49 89 57 08 15 16
F: +49 89 57 08 15 17
M: +49 172 840 88 28

felix....@bitextender.com
http://www.bitextender.com/

Amtsgericht München, HRB 174280
Geschäftsführer: David Zülke, Florian Clever

Michal Charemza

unread,
Oct 20, 2009, 9:34:12 AM10/20/09
to Agavi Users Mailing List

On 20 Oct 2009, at 11:05, Felix Gilcher wrote:
>> $this->getResponse()->setHttpHeader('Pragma', '');
>
> Overwrites the header set by php with an empty value. It should not
> have any side effects. You can use curl or any other low level http
> lib to check whether the header is really removed.

Thank you!

David Zülke

unread,
Oct 20, 2009, 5:24:55 PM10/20/09
to Agavi Users Mailing List
You might however prefer to simply configure it in factories.xml:
<response class="AgaviWebResponse">
<ae:parameter name="http_headers">
<ae:parameter name="Pragma"></ae:parameter>

That should work just as well.

- David

Reply all
Reply to author
Forward
0 new messages