Re: Adding headers based on Content-Type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I've faced a similar problem before. The answer is that there is no easy solution with existing apache module. I need to write an apache module myself to solve the problem. My idea is come from mod_trace_output which can capture output (both headers & content) from another handler. But it doesn't work with apache 1.3x. For Apache 2.x, please refer to apache filter.
 
http://trace-output.sourceforge.net/


 
On Tue, Mar 3, 2009 at 5:30 PM, Foster, Stephen (ASPIRE) <steve.foster@xxxxxxxxxxxxxx> wrote:

Hi there,

 

I have as situation where I need to add custom headers when the response is of a certain type, for example:

 

If the response type is “text/html” I want to add a header of “Content-Style-Type "text/css"”

If the response type is anything other that “text/html” then don’t add anything.

 

Now adding the header is no problem at all but I am struggling to find how to match whether the response type is “text/html”

 

I can match a filetype no problem, e.g

 

<FilesMatch "\.(html|htm)$">

Header set Content-Style-Type "text/css"

</FilesMatch>

 

But the content type will be sent back by dynamic content so that code chunk will not be valid.

 

Anybody have any ideas?

 

Cheers in advance

 

Steve

Capgemini is a trading name used by the Capgemini Group of companies which includes Capgemini UK plc, a company registered in England and Wales (number 943935) whose registered office is at No. 1 Forge End, Woking, Surrey, GU21 6DB.

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux