Rails 3.1.3
在force_ssl到位的情况下,我一遍又一遍地重定向,它永远不会结束。我要去https网址,所以我不确定为什么它会抱怨。想法?
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
答案 0 :(得分:5)
在这里回答:Why am I getting infinite redirect loop with force_ssl in my Rails app?
Spoiler:将其添加到您的nginx配置文件中:
proxy_set_header X-Forwarded-Proto $scheme;
答案 1 :(得分:1)
如果您使用config.force_ssl = true
并以无限循环结束,请尝试以下操作:
在你的nginx配置更改:
listen 443 default ssl;
为:
listen 443;
ssl on;