gpt4 book ai didi

ruby-on-rails - Rails 简单验证码不通过 HTTPS

转载 作者:数据小太阳 更新时间:2023-10-29 08:07:19 25 4
gpt4 key购买 nike

我正在使用 simple_captcha2 gem 进行 Rails 身份验证,并且它在开发中运行良好,但验证码图像/代码不会在生产中通过 SSL 层,因此图像不会在其中呈现验证码形式。我使用这个 letsencrypt 设置了 OpenSSL适用于多个域的教程,它适用于除 simple_captcha2 之外的所有内容。

这是 Firefox 的错误输出:

Loading mixed (insecure) display content "http://example.com/simple_captcha?code=f987a2c87ea145419d79a00d6a257df701e2bea8&time=1465962694" on a secure page

最佳答案

将以下行(如 here 所述)添加到我的 nginx.conf 解决了 request.protocol 返回错误协议(protocol)的问题:

proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Ssl on;

就无法加载验证码图像而言,无论是安全内容还是不安全内容,都必须安装 imagemagick

关于ruby-on-rails - Rails 简单验证码不通过 HTTPS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37826048/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com