You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Ben Johnson <be...@indietorrent.org> on 2012/10/03 17:07:20 UTC

Re: [users@httpd] gzipping via mod_deflate, the DeflateBufferSize, the Content-Length header, and download progress in Web browsers


On 9/26/2012 12:39 PM, Eric Covener wrote:
>> Is there any chance that the SetEnvIfNoCase directive is not being
>> satisfied due to the mod_rewrite rules that I'm using?
> 
> There's always a way for things to go wrong with mod_rewrite.
> 
> SetEnvIf would run both before and after your rewrite on both the
> rewritten and un-rewritten URL, and environment variables would not
> really live from the first pass to the second which is I think what
> you're counting on.  I suggest adding a rule to set no-gzip based on
> the query string you'll redirect to.

Given that the original *and* rewritten URL both end with a file
extension, shouldn't the SetEnvIf directive be effective in either case?

The original URLs take the following format:

https://localhost/public/download/My%20Installer.zip

The following mod_rewrite rules are applied:

# Rewrite URIs of the form 'index.php?q=x' (except for real
files/directories):
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

(Note that these download files are NOT real files; they are passed to
the browser via PHP script; so, the mod_rewrite rules are applied.)

The resultant URLs take the following format:

https://localhost/public/index.php?q=download/My%20Installer.zip

After the rewriting is done, the relevant Apache server environment
variables look like this:

'REQUEST_METHOD' => string 'GET' (length=3)
'QUERY_STRING' => string 'q=download/My Installer.zip' (length=68)
'REQUEST_URI' => string '/public/download/My%20Installer.zip' (length=87)
'SCRIPT_NAME' => string '/public/index.php' (length=20)
'PHP_SELF' => string '/public/index.php' (length=20)

Given the above, shouldn't this rule be effective?

# Don't compress images (or other files that are already compressed)
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png|zip|7z|rar|sit?x|mp3|flac|ogg|pdf)$ no-gzip dont-vary

> Before you chase that, you can just log it the internal var with
> %{no-gzip}e and %{REDIRECT_no-gzip}e

Forgive me for being dense here, but do you mind restating this last
bit? It seems like there's a typo. Are you suggesting that I should try
logging the values for %{no-gzip}e and %{REDIRECT_no-gzip}e before I
bother with anything else?

Thanks again, Eric.

-Ben

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org