rgeissert / http-redirector

Debian mirrors HTTP redirector
http://httpredir.debian.org/
88 stars 8 forks source link

Redirects are not permanent #65

Open da2x opened 9 years ago

da2x commented 9 years ago

Incorrectly sends the 301 response code when redirecting. The 302 or 307 response code is more appropriate as the redirects are not meant to be permanent, but only temporary.

rgeissert commented 9 years ago

Could you explain what makes you think that a redirection for an object that is never going to be modified should not be considered as permanent?

da2x commented 9 years ago

The redirector is supposed to redirect requests to different mirrors and not permanently point all future requests to just one mirror. With a permanent redirect, clients (including caches) are supposed to direct future requests to the new address instead of asking the redirector to find the best mirror for it at any given time.

RFC definition follow:

307: “The requested resource resides temporarily under a different URI. Since the redirection MAY be altered on occasion, the client SHOULD continue to use the Request-URI for future requests. This response is only cacheable if indicated by a Cache-Control or Expires header field.”

308: “The 308 (Permanent Redirect) status code indicates that the target resource has been assigned a new permanent URI and any future references to this resource ought to use one of the enclosed URIs. Clients with link editing capabilities ought to automatically re-link references to the effective request URI one or more of the new references sent by the server, where possible.”