skip/disable force_ssl for particular controller in rails

后端 未结 3 1386
夕颜
夕颜 2020-12-17 16:53

I need to force SSL on all routes in my application except for message#new controller.

In config/environments/production.rb, I have:

<
3条回答
  •  忘掉有多难
    2020-12-17 17:06

    according to documentation following should work (but only for rails > 5 version):

    config.ssl_options = {
      redirect: {
        exclude: -> request { request.path =~ /healthcheck/ }
      }
    }
    

提交回复
热议问题