Force_ssl causes infinite redirects
Rails 3.1.3
With force_ssl, I get this redirect over and over and it never ends. I am switching to https url so not sure why else it will complain. Ideas?
Started GET "/app/admin/calendar" for 69.64.227.254 at 2012-02-13 19:52:44 +0000
Processing by Admin::CalendarsController#show as HTML
User Load (1.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = 21 ORDER BY lower(first) ASC LIMIT 1
Account Load (0.6ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."id" = 23 AND (accounts.deleted_at IS NULL) LIMIT 1
Redirected to https://www.mydomain.net/app/admin/calendar
Completed 301 Moved Permanently in 4ms
+2
source to share
2 answers
The answer is here: Why am I getting an infinite redirect loop with force_ssl in my Rails app?
Spoiler alert: add this to your nginx config file:
proxy_set_header X-Forwarded-Proto $scheme;
+5
source to share
If you are using config.force_ssl = true
and ending with an infinite loop try this:
In your nginx config change:
listen 443 default ssl;
in
listen 443;
ssl on;
Credits to pjammer: Nginx configuration leads to infinite redirect loop
+1
source to share