Modify Apache http headers from perl?

M

Mark

Hi,

In order to stop certain documents from caching I would like to modify
the http headers generated by the server. I have tried the usual meta
tag solution and a variety of other suggestiongs but find that whilst
they may work in one browser they fail in others, and I have been told
that modifying the server http header is the only reliable method.

Unfortunately I am on a shared hosting plan with no telnet access so
the only way I might be able ot modify the server parameters is
through perl. There are only a few documents that I do not want to be
cached and it would be handy if I could tell the script generating the
document to change the header to 'no cache', deliver the document and
then change it back to a normal header.

Does anyone know if this is possible in perl and which commands,
modules, etc. I should be looking at?

Many thanks for your time and consideration.

Mark
 
D

David Efflandt

In order to stop certain documents from caching I would like to modify
the http headers generated by the server. I have tried the usual meta
tag solution and a variety of other suggestiongs but find that whilst
they may work in one browser they fail in others, and I have been told
that modifying the server http header is the only reliable method.

Unfortunately I am on a shared hosting plan with no telnet access so
the only way I might be able ot modify the server parameters is
through perl. There are only a few documents that I do not want to be
cached and it would be handy if I could tell the script generating the
document to change the header to 'no cache', deliver the document and
then change it back to a normal header.

Does anyone know if this is possible in perl and which commands,
modules, etc. I should be looking at?

If using CGI.pm, you could put special headers within the header(). But
if you print the headers yourself, there is nothing Perl specific about
it.

HTTP headers are one per line, with the last header separated from content
by a blank line. So when you print Content-type and any other reply
headers, just make sure you do NOT have any blank lines (or double
newline) until the end of the LAST header. No need to change anything
back either, HTTP is one request, and one reply. But if a single script
handles multiple types of requests for cached and non-cached output,
determine which before printing any headers.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top