Posted about 2 years ago. Visible to the public. Repeats.

Be very careful with 301 redirects

Browsers support two kinds of redirects:

  • 301 moved permanently
  • 302 moved temporarily

Be very careful with the 301 type. Most browsers seem to cache these redirects forever, unless you set different Cache-Control headers. If you don't have any cache control headers, you can never change them without forcing users to empty their cache.

The only fix is to keep redirecting the user to the correct page, so if you had

Copy
/page-1 --301--> /page-2

but you want

Copy
/page-1 --301-> /page-3

your only fix is to change it to

Copy
/page-1 ------> /page-3 *AND* /page-2 ------> /page-3

This means that /page-2 will become unusable as its own page.

Note that a 301 with an explicit expiry via Cache-Control is fine, and might be preferred for SEO purposes.

Does your version of Ruby on Rails still receive security updates?
Rails LTS provides security patches for old versions of Ruby on Rails (3.2 and 2.3).

Owner of this card:

Avatar
Tobias Kraze
Last edit:
about 2 years ago
by Henning Koch
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Tobias Kraze to makandra dev
This website uses cookies to improve usability and analyze traffic.
Accept or learn more