电子邮件中的 Sendgrid 链接产生您的连接不是浏览器中的私人错误

che*_*ell 11 email ruby-on-rails heroku sendgrid

Rails 5.2 SendGrid Heroku 应用程序

我在电子邮件中有一个链接可以查看报告。这些链接在开发中完美运行。

但是,当 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
Run Code Online (Sandbox Code Playgroud)

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

  # 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' }
Run Code Online (Sandbox Code Playgroud)

来自其他 SO 用户,上述内容对他们有用。但是,它对我不起作用。

任何帮助表示赞赏。

jac*_*fwd 12

您是否在您的 SendGrid 帐户上启用了 SSL 点击跟踪

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

  • 让 SSL 单独工作所需的麻烦导致我关闭了点击跟踪。推理是:如果您发送自己的链接,它很可能会经过分析,因此它实际上并不是“未跟踪”,但它也不再具有垃圾邮件的氛围。 (4认同)

che*_*ell 2

我已经找到问题了。

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

config.action_mailer.default_url_options = { host: 'https://provenword.herokuapp.com' }
Run Code Online (Sandbox Code Playgroud)

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

感谢大家的帮助。