Wednesday, December 10, 2008

Set HTTP Response Header Cache-Control and enable mod_cache for higher performance

To enable the ability of caching of pictures open the httpd.conf of your IBM HTTP Server and add following lines

LoadModule headers_module modules/mod_headers.so

<Location ~ "\.(jsgifjpgjpegpngjpe)$">

Header add Cache-Control "public, max-age=432000, post-check=172000"

</Location>

These lines enable the module mod_headers.so and are setting a Cache-Control header. A Cache-Control header enables clients, webservers and proxys to cache pictures.

Adding the Cache-Control-Header is very useful for older Liferay-Versions.

To enable a IBM HTTP Server to cache those pictures add additionally these lines:

LoadModule cache_module modules/mod_cache.so

LoadModule mem_cache_module modules/mod_mem_cache.so

<IfModule mod_mem_cache.c>

CacheEnable mem /

MCacheSize 4096

MCacheMaxObjectCount 100

MCacheMinObjectSize 1M

CacheMaxObjectSize 2048

</IfModule>

Link to sample httpd.conf

3 Kommentare:

Xosema Pena said...

THANKS¡¡¡ Really really Great BLOG¡¡¡
take a look mine:
http://xosemapena.blogspot.com/

skywalker said...

one question to ask help.

If I didn't install IBM HTTP Server, only installed WAS6.0 app server, how can I set HTTP response header in the server?

Simply to say, I can not find any file named "httpd.conf". how can I do to set HTTP header??

eichelgartenweg said...

the httpd.conf is part of the ibm http server config. so you need to install IBM HTTP Server.

If you want to modify a HTTP Header, try to edit the Headers in a JSP which is deployed in your AppServer.
Google should know more.