Forums / Developer / Specific HTTP header

Specific HTTP header

Author Message

Maxime Thomas

Tuesday 12 October 2010 5:13:36 am

Hi community,

My need is the following : I'm developping an extra layer on top of eZPublish and I have to get extra http headers from it without modifying the actual content.
How can I enforce eZPublish to set specific http headers without touching the kernel or developping an extra heavy extension ?

I've found some Cache-Control and other things in the site.ini but it not seems to be a generic mecanism.

Any help will do it.

Maxime Thomas
[email protected] | www.wascou.org | http://twitter.com/wascou

Company Blog : http://www.wascou.org/eng/Company/Blog
Technical Blog : http://share.ez.no/blogs/maxime-thomas

Ivo Lukac

Tuesday 12 October 2010 5:42:59 am

Hi,

You should be able to do this in [HTTPHeaderSettings] in site.ini. Just add your header in HeaderList[] and specify it with your_header[]

Don't forget to enable CustomHeader there too

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

Gaetano Giunta

Tuesday 12 October 2010 6:09:39 am

If you need the editors / the content to be able to set the source of those headers, use the persistent_variable:

. node template sets the desired header in the persistent var

. pagelayout tpl uses a custom template operator to send the header if it finds it in $module_result.persistent_variable

Principal Consultant International Business
Member of the Community Project Board

Maxime Thomas

Tuesday 12 October 2010 9:49:09 am

Thank you, I will try this one tomorrow.

And of course for the persistent_variable.

Maxime Thomas
[email protected] | www.wascou.org | http://twitter.com/wascou

Company Blog : http://www.wascou.org/eng/Company/Blog
Technical Blog : http://share.ez.no/blogs/maxime-thomas

Maxime Thomas

Wednesday 13 October 2010 6:25:26 am

Yes it works.

[HTTPHeaderSettings] CustomHeader=enabled 
HeaderList[] HeaderList[]=Content-type 
Content-type[]
Content-type[/]=blabla

Gracias.

Maxime Thomas
[email protected] | www.wascou.org | http://twitter.com/wascou

Company Blog : http://www.wascou.org/eng/Company/Blog
Technical Blog : http://share.ez.no/blogs/maxime-thomas