Change protocol to https in all rails helpers

后端 未结 9 1611
情书的邮戳
情书的邮戳 2020-12-10 12:55

Rails 3.1+ I want my url helpers to use the https protocol without having to specify it in every helper I call. After searching around I\'ve found various ways but none work

9条回答
  •  清歌不尽
    2020-12-10 13:27

    Whichever environment you want to use ssl (https://), just add this config lines to its configuration file in config/environments:

    YOURAPPNAME::Application.configure do
    
      # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
      config.force_ssl = true
    end
    

提交回复
热议问题