josh/rack-ssl — pull request #22 by jpignata (2013-01-18 16:09:43+00:00)
Title: Allow redirect status code to be configured as temporary

Under certain circumstances it may be more desirable to return a temporary redirect (302) to agents rather than a permanent one (301). This change adds an option to the initializer that will cause all redirects to use the 302 response code. By default it will continue to return a 301 status code.

---

The motivation behind this change is that we recently had a configurable error introduced by an upstream proxy that stripped the X-Forwarded-Proto header before the request hit our application. The result of this error was that we redirected the user back to the same URL they were already hitting. It turns out browsers aggressively cache 301s so this issue had a huge impact.

As the site where we're using this is only an API and we don't have any concerns about permanently redirecting search engines or other agents to a resources primary home, using a temporary redirect is actually preferable for us for safety reasons.