RE: How to conditionally enable mod_deflate?

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

 



Hi Tom,

Here is how I have the setup currently on the original apache. GZIP is enabled, and turned off for specific file types.
	######20121011 SKB to test optimization
	SetOutputFilter DEFLATE

	SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|swf)$ no-gzip dont-vary
	SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
	SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary
	######

The flag to determine whether the access is being made via the proxy is 
	RequestHeader set RemoteUser "remote"

Now on the original apache, I want to disable GZIP when RemoteUser Request Header is not present in the request.

Can you please help with the syntax of SetEnvIf to set no-gzip if the request header is not present.

Somehow, I am able to check the Request_URI header, but not my custom header, which is being added from the proxy apache.

______________________________
Sudip Kumar Bhattacharya


-----Original Message-----
From: Tom Evans [mailto:tevans.uk@xxxxxxxxxxxxxx] 
Sent: Friday, October 19, 2012 9:38 PM
To: users@xxxxxxxxxxxxxxxx
Subject: Re:  How to conditionally enable mod_deflate?

On Fri, Oct 19, 2012 at 4:44 PM, Bhattacharya, Sudip <sudip.bhattacharya@xxxxxxxxxxx> wrote:
> Hi All,
>
>
>
> I have a problem for which I am not able to find a solution.
>
>
>
> I need to conditionally enable mod_deflate for clients who send a 
> particular custom HTTP Request Header.
>
> Let’s say this HTTP Request Header is like this:
>
> IWANTGZIPDATA=true
>
>
>
> Now my condition should be like this:
>
>
>
> If IWANTGZIPDATA=true then
>
>                 Enable gzip
>
> Else if IWANTGZIPDATA=false OR IWANTGZIPDATA is not present in request 
> Then
>
>                 Disable gzip
>
> End if.
>
>
>

Enable mod_deflate, and use mod_setenvif, mod_headers or mod_rewrite to set either the environment variable "force-gzip" or "no-gzip", as documented on the mod_deflate manual page.

http://httpd.apache.org/docs/2.2/mod/mod_deflate.html

Cheers

Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


This e-mail (and any attachments), is confidential and may be privileged. It may be read, copied and used only
by intended recipients. Unauthorized access to this e-mail (or attachments) and disclosure or copying of its 
contents or any action taken in reliance on it is unlawful. Unintended recipients must notify the sender immediately 
by e-mail/phone & delete it from their system without making any copies or disclosing it to a third person.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[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