SSL не может установить sh безопасное соединение - с приложением Rails 6 с использованием Devise в Heroku - PullRequest
0 голосов
/ 03 августа 2020

Как сказано в названии, у меня есть приложение Rails 6, работающее на Heroku, с автоматическим c SSL-сертификатом, который предоставляет Heroku. Все работает отлично, я могу посетить любую страницу, и на ней все работает нормально. Однако есть одно исключение: когда пользователи регистрируются и получают электронное письмо с подтверждением, нажатие на ссылку по какой-то причине не работает (см. Прикрепленные скриншоты ниже), и то же самое происходит, даже если вы копируете + вставляете ссылка в новой вкладке, конечно.

  • Ruby версия: 2.7.1p83
  • Версия Rails: 6.0.3.1

Safari screenshot Firefox: enter image description here

This is what I get when trying to access that url https://my_domain.com/users/confirmation?confirmation_token=foobar.

My environments/production.rb has these settings:

Rails.application.configure do
  # a few more non important things, and then:
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.perform_deliveries = true
  config.action_mailer.smtp_settings = {
    :user_name => ENV['SENDGRID_USERNAME'],
    :password => ENV['SENDGRID_PASSWORD'],
    :domain => 'my_domain.com',
    :address => 'smtp.sendgrid.net',
    :port => 587,
    :authentication => :plain,
    :enable_starttls_auto => true
  }


  config.force_ssl = true
  config.action_mailer.default_url_options = { :host => 'my_domain.com' }
end

And this is what it looks like in Heroku:

enter image description here

I have these routes for Devise:

Rails.application.routes.draw do
  devise_for :users, controllers: { registrations: 'users/registrations',
                                    confirmations: 'users/confirmations' }
  authenticated :user do
    root to: "depots#index", as: :authenticated_root
  end

  root to: "public/welcome#index"
end

And the controller looks like this:

class Users::ConfirmationsController < Devise::ConfirmationsController
  def after_confirmation_path_for(resource_name, resource)
    sign_in(resource)
    authenticated_root_path
  end
end

Do you guys have any idea on what could be wrong? And if not, any advice on how to troubleshoot this?

UPDATE Aug, 04, 2020:

I had added this redirect to my domain but even though it works redirecting from grownis.com to www.grownis.com it doesn't for https://grownis.com

введите описание изображения здесь

1 Ответ

0 голосов
/ 04 августа 2020

Ваш сертификат не является сертификатом с подстановочным знаком. Пожалуйста, проверьте эту ссылку.

https://grownis.com/

Ссылка для подтверждения: https://grownis.com/users/confirmation?confirmation_token=CONRIMATION_TOKEN

Вам нужно будет сделать перенаправление с не- www to www or подстановочного сертификата покупки.

...