电子邮件中的Sendgrid链接生成您的连接在浏览器

时间:2018-06-18 10:23:54

标签: ruby-on-rails email heroku sendgrid

Rails 5.2 SendGrid Heroku App

我在电子邮件中有一个链接来查看报告。 这些链接在开发中非常有效。

但是,当SendGrid在生产中发送电子邮件时,我点击电子邮件中的链接,我在浏览器中收到以下错误:

Your connection is not private
Attackers might be trying to steal your information from myapp.heroku.com (for example, passwords, messages, or credit cards). Learn more
NET::ERR_CERT_COMMON_NAME_INVALID

在我的生产配置中,我有以下内容:

  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
  config.force_ssl = true

config.action_mailer.default_url_options = { host: 'https://provenwordapp.heroku.com' }

来自其他SO用户,以上为他们工作。但是,它不适合我。

任何帮助表示感谢。

2 个答案:

答案 0 :(得分:2)

您的SendGrid帐户中有enabled SSL Click Tracking吗?

该错误通常是因为您正在使用HTTPS> HTTP连接,反之亦然。如果您启用了SendGrid的点击跟踪,但未启用SSL,则其跟踪链接将为http://,即使您的基本链接为https://

答案 1 :(得分:1)

我找到了问题。

我没有在Heroku上为我的应用程序使用正确的URL。

config.action_mailer.default_url_options = { host: 'https://provenword.herokuapp.com' }

我写过heroku.com而不是herokuapp.com

感谢大家的帮助。