The SFMTA has various archival documents on the www.sfmta.com 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:  
http://www.sfmta.com/cms/cmta/documents/2-15-11Item11.pdf

Example referer:
http://www.sfmta.com/cms/cmta/SFMTABoardFeb.152011SpecialMeetingagenda.h
tm

.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/
[NC]
RewriteCond %{QUERY_STRING} !^giveMeTheArchive$
RewriteRule ^(.*)$
/cms/asystem/302-archive-warning.php?request=/cms/cmta/documents/$1 [R]

www.sfmta.com/cms/asystem/302-archive-warning.php?request=/cms/cmta/docu
ments/2-15-11Item11.pdf 
will give a warning page which produces a sanitized link to
http://www.sfmta.com/cms/cmta/documents/2-15-11Item11.pdf?giveMeTheArchi
ve

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
Referer: 
http://www.sfmta.com/cms/cmta/SFMTABoardFeb.152011SpecialMeetingagenda.h
tm
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
GET
/cms/asystem/302-archive-warning.php?request=/cms/cmta/documents/2-15-11
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:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
   "   from the digest: users-digest-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org

Reply via email to