繁体   English   中英

Rails-帐户激活未重定向到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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM