Change protocol to https in all rails helpers

后端 未结 9 1608
情书的邮戳
情书的邮戳 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:24

    If you want to force SSL on your application, this can be done by setting config.force_ssl to true in your application.rb (or your environment specific file). More on the subject here

    EDIT Ok so I don't find enough evidence for this, but I think you can override default_url_options=(options={}) in application controller, and set :protocol => :https in the function body. If this does not the trick for your emails, you'll have to repeat the procedure in your environment config by adding config.action_mailer.default_url_options. Hope this does it!

提交回复
热议问题