![](/img/trans.png)
[英]Rails ActiveStorage / Cloudinary Not Redirecting Image Request to HTTPS
[英]Rails - Account Activation not redirecting to https
我的郵件發送者發送了一個帳戶激活鏈接,如下所示:
edit_account_activation_url(@ user.activation_token,電子郵件:@ user.email)
生產:
http:// MYAPPHOST / account_activation / 7Apxg0G5t2V5tHrO2tatPQ / edit?email = sdf%40oiu.com
當我將其更改為https時,它可以工作,但沒有被重定向。 我已經有config.force_ssl = true,所以我不確定如何啟用此重定向。 任何幫助表示贊賞。
每當我訪問http:// MYAPP時,我都會重定向到about:blank
我假設這是在您的生產環境中? 您正在使用哪種托管服務提供商和/或服務器(Heroku,AWS和Apache,NGINX等)。
檢查您的Web服務器的SSL設置,尤其是X-Forwarded-Proto
標頭。 當HTTPS請求到達Apache / NGINX時,它們將終止SSL連接,並將HTTP請求發送到Unicorn / Puma / Thin / Webrick。 除非您設置X-Forwarded-Proto
標頭,否則您的Rails服務器將看到protocol=HTTP
。 這將導致您的x_y_z_url
幫助器返回http://...
而不是https://...
例如,在NGINX中:
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.