Modify Apache http headers from perl?

Discussion in 'Perl Misc' started by Mark, Sep 12, 2003.

  1. Mark

    Mark Guest

    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
    Mark, Sep 12, 2003
    #1
    1. Advertising

  2. On Fri, 12 Sep 2003, Mark <> wrote:
    > 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.

    --
    David Efflandt - All spam ignored http://www.de-srv.com/
    David Efflandt, Sep 12, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    4
    Views:
    1,061
    Gibble
    May 10, 2007
  2. tanmoy.b81
    Replies:
    0
    Views:
    891
    tanmoy.b81
    Feb 4, 2009
  3. Ian
    Replies:
    2
    Views:
    1,940
  4. Nils

    Howto modify HTTP Headers in XML Webservice

    Nils, Feb 19, 2007, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    300
  5. wana
    Replies:
    0
    Views:
    179
Loading...

Share This Page