Salih,

Here is a patch that could be run against mod_headers.c that will
add a new action "fset" which will set a header only if the header is
not set before.

Apply the patch using:
$ patch mod_headers.c < mod_headers.c.fset_patch

Compile and install to your 2.2.X Apache using:
$ /path/to/apache/bin/apxs -i -c mod_headers.c

Use it as:
Header fset MyHeader "Some Text"

I couldn't get a better name than "fset".  Also this is built and tested
against 2.2.8, I don't know if it should be different for 2.0.X.

Regards,
Tamer

-----Original Message-----
From: Mohammed Salih [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 22, 2008 9:56 AM
To: users@httpd.apache.org
Subject: Re: [EMAIL PROTECTED] Adding a Header to the httpd response

Thank you Joshua for your response,

I tried to use the SetEnvIf and Header combination before, but as you
said SetEnvIf is only useful for the request headers.
So can you please help me in creating the negative-lookahead regex. I
am very bad at regex.

Thanks in advance.
Salih

On Mon, Apr 21, 2008 at 6:47 PM, Joshua Slive <[EMAIL PROTECTED]> wrote:
> On Mon, Apr 21, 2008 at 10:34 AM, Joshua Slive <[EMAIL PROTECTED]> wrote:
>  > On Mon, Apr 21, 2008 at 9:38 AM, Mohammed Salih <[EMAIL PROTECTED]> wrote:
>  >  > Thank you all for your reply.
>  >  >
>  >  >  Yes I am using Header to set the Cache-Control header. and it is doing
>  >  >  it job. but some times the application might have already set this
>  >  >  header. So I want to avoid setting it again using the Header module.
>  >  >
>  >
>  >  See example #4:
>  >  http://httpd.apache.org/docs/2.2/mod/mod_headers.html#examples
>  >
>  >  SetEnvIf Cache-Control .+ got-cache-control=1
>  >  Header set Cache-Control blah env=!got-cache-control
>
>  Oh, wait a sec. That's not going to work because SetEnvIf matches
>  request headers, not response headers.
>
>  You could try "Header edit" using a negative-lookahead regex to
>  exclude requests already containing something in Cache-Control. Other
>  than that, I think this would require a simple custom module.
>
>
>
>  Joshua.
>
>  ---------------------------------------------------------------------
>  The official User-To-User support forum of the Apache HTTP Server Project.
>  See <URL:http://httpd.apache.org/userslist.html> for more info.
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>    "   from the digest: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: [EMAIL PROTECTED]
   "   from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Attachment: mod_headers.c.fset_patch
Description: mod_headers.c.fset_patch

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: [EMAIL PROTECTED]
   "   from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to