Firefox和Chrome持续使用nginx / Passenger在Rails应用上强制HTTPS
我有一个非常奇怪的问题,每次我尝试在非SSL模式下浏览我的Rails应用程序时,Chrome(v16)和Firefox(v7)会不断强制我的网站以HTTPS的forms提供服务。 我的Rails应用程序部署在使用Capistrano,nginx,Passenger和通配符SSL证书的Ubuntu VPS上。 我在nginx.conf中为端口80设置了这些参数: passenger_set_cgi_param HTTP_X_FORWARDED_PROTO http; passenger_set_cgi_param HTTPS off; 我的nginx.conf的长版本可以在这里find: https : //gist.github.com/2eab42666c609b015bff ssl-redirect.include文件包含: rewrite ^/sign_up https://$host$request_uri? permanent ; rewrite ^/login https://$host$request_uri? permanent ; rewrite ^/settings/password https://$host$request_uri? permanent ; 当来自非SSL请求时,确保这三个页面使用HTTPS。 我的production.rb文件包含这一行: # Enable HTTP and HTTPS in parallel config.middleware.insert_before Rack::Lock, Rack::SSL, :exclude => proc { |env| env['HTTPS'] != 'on' } 我已经尝试通过nginx重写redirect到HTTP,Ruby on Railsredirect,也使用Rails视图使用HTTP协议的URL。 我的application.rb文件包含在before_filter钩子中使用的这个方法: […]