Force SSL for specific routes in Rails 3.1

后端 未结 3 978
[愿得一人]
[愿得一人] 2021-02-20 04:32

I need to force SSL on all routes in my application except for landing#index.

In config/application.rb, I have:



        
3条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-20 05:01

    You can do it this way:

    controller

    force_ssl :except => :index
    

    view

    supposing your index path name is index_landing_path

    <%= link_to 'Landing', index_landing_path, :protocol => 'http' %>
    

提交回复
热议问题