Reduce the size of redirects

Bug #855195 reported by François Marier
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Libravatar (obsolete)
Fix Released
High
François Marier

Bug Description

Given that we serve mostly redirects to Gravatar at the moment, we should optimise that path very carefully.

The 302 responses we send out unfortunately include a body that's just as large as the headers:

$ curl -i http://cdn.libravatar.org/avatar/12345678901234567890123456789012HTTP/1.1 302 Found
Date: Wed, 21 Sep 2011 01:51:52 GMT
Server: Apache
Cache-Control: max-age=86400
Location: http://www.gravatar.com/avatar/12345678901234567890123456789012.jpg?r=g&s=80&d=http://cdn.libravatar.org/nobody/80.png
Vary: Accept-Encoding
Content-Length: 310
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="http://www.gravatar.com/avatar/12345678901234567890123456789012.jpg?r=g&amp;s=80&amp;d=http://cdn.libravatar.org/nobody/80.png">here</a>.</p>
</body></html>

Maybe there is a way to override the default redirection template in Apache...

Revision history for this message
François Marier (fmarier) wrote :
Revision history for this message
François Marier (fmarier) wrote :

It looks like this will work:

  ErrorDocument 302 " "

and result in a 1-byte response in the body:

"$ curl -i http://localhost/redir/
HTTP/1.1 302 Found
Date: Wed, 21 Sep 2011 03:37:50 GMT
Server: Apache
Location: http://www.example.com
Vary: Accept-Encoding
Content-Length: 1
Content-Type: text/html; charset=iso-8859-1

 "

while returning this:

   ErrorDocument 302 /302

(where /302 is an empty file)

won't preserve the Location header:

"$ curl -i http://localhost/redir/
HTTP/1.1 302 Found
Date: Wed, 21 Sep 2011 03:39:26 GMT
Server: Apache
Last-Modified: Wed, 21 Sep 2011 03:39:17 GMT
ETag: "8024d-0-4ad6b52201036"
Accept-Ranges: bytes
Content-Length: 0
Content-Type: text/plain

"

Changed in libravatar:
assignee: nobody → François Marier (fmarier)
Changed in libravatar:
status: Confirmed → Fix Committed
Changed in libravatar:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.