部署 devise 中使用邮件确认,邮件链接返回隐私设置错误

runup · 2018年11月28日 · 6084 次阅读

已经解决,host 的地址写错了,应该是

host = "note-book-diary.herokuapp.com"

使用了 devise 中的 confirmable 模块,部署到了 heroku 中,邮件采用 heroku 中 sendgrid,具体的配置信息如下:

#config/environments/production.rb
config.force_ssl = true

config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp

host = "note-book-diary.heroku.com"
config.action_mailer.default_url_options = { protocol: "https", host: host }
ActionMailer::Base.smtp_settings = {
address: "smtp.sendgrid.net",
port: 587,
authentication: "plain",
user_name: "xx",
password: "xx",
domain: "heroku.com",
enable_starttls_auto: true
}

访问https://note-book-diary.heroku.com/的时候不会出现任何问题,包括注册和登录页面,注册之后能收到邮件,但是邮件中的确认链接点击之后显示如下错误

NET::ERR_CERT_COMMON_NAME_INVALID

指出我的链接不是私密链接,网站使用的是 HSTS,我试着关闭 HSTS,出现也是同样的问题,chrome 和 safari 中都是返回这个结果。

config.ssl_options = { hsts: false }
runup 关闭了讨论。 11月29日 16:15
runup 重新开启了讨论。 11月29日 16:15
runup 关闭了讨论。 11月29日 16:17
需要 登录 后方可回复, 如果你还没有账号请 注册新账号