LoginSignup
0
2

More than 3 years have passed since last update.

Railsのdeviseでコンテナを利用するとログインURLが、コンテナのドメインになってしまう

Posted at

概要

Railsのdeviseでは、未ログイン時に認証が必要なページにアクセスするとログインページへリダイレクトするが、その際、AWSのECS上でコンテナを稼働していると、コンテナがもつドメインにリダイレクトしようとする

実装

default_url_options を指定するだけ

config/application.rb
module Example
  class Application < Rails::Application
    config.action_controller.default_url_options = { host: 'www.example.com', protocol: 'https://', port: nil }
  end
end
0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2