在Elastic Beanstalk上将https:// no-www重定向到https:// www

时间:2017-09-07 19:37:37

标签: ruby-on-rails redirect https elastic-beanstalk

AWS Elastic Beanstalk应用程序(Ruby on Rails):

http://www -> https://www [作品]

http://non-www -> https://www [作品]

https://non-www -> https://www [无效]

1 个答案:

答案 0 :(得分:0)

添加如下所示的路线:

# Redirect example.com => www.example.com
constraints(host: /^example\.com/i) do
  match "/(*path)" => redirect { |params, _req| "https://www.example.com/#{params[:path]}" }, via: [:get, :post]
end