【问题标题】:Redirect https://no-www to https://www on Elastic Beanstalk在 Elastic Beanstalk 上将 https://no-www 重定向到 https://www
【发布时间】:2018-02-16 15:17:01
【问题描述】:

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

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

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

https://non-www -> https://www [不起作用]

【问题讨论】:

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


    【解决方案1】:

    添加如下所示的路线:

    # 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
    

    【讨论】:

    • 我们应该把这个放在哪里?
    • 它在config/routes.rb,我相信在顶部。
    猜你喜欢
    • 2012-06-09
    • 1970-01-01
    • 2018-04-22
    • 2019-10-26
    • 2018-07-03
    • 1970-01-01
    • 2020-05-22
    • 2016-09-24
    相关资源
    最近更新 更多