Live data from Hacker News

301 redirects: a dangerous one way street (2012)

jacquesmattheij.com

21–30 of 92 posts

Re: 301 redirects: a dangerous one way street (2012)

#21
I have a draft blogpost (somehow octopress did not respect my darft: true setting) that describes the same problem: http://ragmaanir.mypresident.de/blog/2015/08/03/ruby-web-dev...

Also, 301 might poison proxy-caches, so even if you clear the cache in your browser it might still not work.

Re: 301 redirects: a dangerous one way street (2012)

#22

Why not just redirect back from the new to the old URL? A sane client should then check if the old 301 is still there (not sure if by the spec, but it is common sense). I believe I once tried this and it worked with Firefox. Not sure, though.

If you are lucky enough to have control over the new URL.

edit: > A sane client should then check if the old 301 is still there Check out kijin's comment about this.

Re: 301 redirects: a dangerous one way street (2012)

#25

That's what permanent means. "Adjective permanent Without end, eternal. Lasting for an indefinitely long time. " Also, "This response is cacheable unless indicated otherwise," says RFC 2616. Working as designed, IMNSHO. Perhaps not working as intended , but alas, that's a case of ¬RTFM.

It's unreasonable to cache it for longer than a very long time (3 months or so). Nothing in "cache" says permanent storage.

Re: 301 redirects: a dangerous one way street (2012)

#27
post #14

That's what permanent means. "Adjective permanent Without end, eternal. Lasting for an indefinitely long time. " Also, "This response is cacheable unless indicated otherwise," says RFC 2616. Working as designed, IMNSHO. Perhaps not working as intended , but alas, that's a case of ¬RTFM.

This seems yet another example of web professionals not understanding HTTP. Much like webpages that say "404 not found" with a "200 OK" header.

In their defense that is probably the case of their MVC framework or CMS returning a 200 after not being able to match the route and not really them doing it on purpose.

But yeah, I agree- (though I've missed them I'm sure) I pretty voraciously make sure my HTTP status matches my intended response- and sometimes that means you've got to write the code in the controller that tells the request to specifically return a certain status.

Re: 301 redirects: a dangerous one way street (2012)

#28
post #7

I took over a domain which had previously 301-redirected HTTP:// to HTTPS://. It caused us no end of trouble getting the alpha site online -- obviously we set up SSL but we didn't realise it was the _first thing we'd have to do_. It also caused half a day of confusion to understand why some of our web browsers were still failing to connect and others could see the alpha site (because they'd never visited the previous…

This isn't just a problem with things like HTTP. The industry as a whole lacks a standard uniform way of dealing with domain transfers or expiration. CAs for example will happily issue certificates that expire after your domain.

Re: 301 redirects: a dangerous one way street (2012)

#29
When working with non-trivial redirects, test them with something like "wget -S $url" instead of your browser. The redirect caching makes it very painful to to repeatedly test the same redirect.

Also, start with a 302, and only change the status to 301 once you're confident they are correct.

Post reply on HN