httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Belov, Charles" <>
Subject [users@httpd] Rewrite conflicts with partial downloads
Date Tue, 15 Feb 2011 19:52:59 GMT
The SFMTA has various archival documents on the website
which we need to retain without modification for public disclosure.  As
the documents have the potential of being mistaken for current
information, I put in a feature in which a request that comes in without
a referer from a document's parent directory will be shown a warning
page informing the requestor that the document is archival.  They can
then follow an altered link to the document which will not require an
authorized referer.

I had to back this change out because it turns out that when Internet
Explorer (and possibly other browsers) do this download, it sends a
referer for the initial request but then sends additional partial
requests without the referer.  So the first part of the file gets
downloaded, then requests for additional parts of the file get
redirected to the warning page, causing Internet Explorer to freeze.

The question is, is there a way I can indicate to mod_rewrite that this
is a follow-up partial request -- that is, detect the range request
header -- and that it is not to do a rewrite of the URL?

I plan to separately report this as a bug to Microsoft, but in the
meantime, site visitors need to be able to access the file without
freezing their browser.  So the question is, is there a way I can
prevent the rewrite in the case of a partial request?

Details follow:

Example file of interest:

Example referer:

.htaccess rewrite code for the /cms/cmta/documents directory (currently
backed out):

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(www\.)?sfmta\.com/cms/cmta/ [NC]
RewriteCond %{HTTP_REFERER} !^https://sfmta\.securesites\.net/cms/cmta/
RewriteCond %{QUERY_STRING} !^giveMeTheArchive$
RewriteRule ^(.*)$
/cms/asystem/302-archive-warning.php?request=/cms/cmta/documents/$1 [R]
will give a warning page which produces a sanitized link to

Server log for a sample Internet Explorer request:

Request 1 at 9:21:06 PT: 
GET /cms/cmta/documents/2-15-11Item11.pdf HTTP/1.1
Result:  200 OK status, 751,863 bytes 

Request 2 at 9:21:07 PT:
GET /cms/cmta/documents/2-15-11Item11.pdf HTTP/1.1
Referer: -
Result:  303 See Other status, 253 bytes

Request 3 at 9:21:07 PT
Item11.pdf HTTP/1.1
Referer: -
Result:  416 Requested Range Not Satisfiable status, 230 bytes

Well, of course there is a 416, since the request is no longer for the
PDF but for the warning page.  But it's a moot point, since the task was
in trouble as of request 2 when it came in without a referer, even
though it's a follow-up on request 1, which did have the referer, and
got redirected.

Hope this helps,
Charles Belov
SFMTA Webmaster

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message