2

我試圖讓HTTPS爲我的網站工作,但我對所有的發佈請求都收到了ActionController::InvalidAuthenticityToken。我登錄了form_authenticity_paramform_authenticity_token,它們實際上是不同的。使用HTTPS + ELB的Rails InvalidAuthenticityToken

在Elastic Load Balancer中解析SSL,並向Web應用發送非SSL請求。預期的CSRF令牌存儲在基於cookie的會話中,因此HTTP和HTTPS的會話似乎期望不同的令牌。在網站上使用HTTP時,post/put請求可以正常工作。

我一直在這個問題上停留了一下。任何建議將有幫助

+0

你解決這個問題? – Bastiano

+0

你是否遇到過'devise/sign_in'或其他任何形式的問題? –

回答

1

我有同樣的問題,但它不是鐵軌。

我固定在我的nginx.config添加proxy_set_header X-Forwarded-Proto https;問題

location @videos { 
    proxy_pass http://videos; 
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    proxy_set_header X-Forwarded-Proto https; 
    proxy_set_header Host $http_host; 
    proxy_redirect off; 
    } 
相關問題