Paritosh Piplewar
Paritosh Piplewar

Reputation: 8122

how do disable force_ssl option for just one action?

We have

config.force_ssl = true

in production environment.

I want to disable this setting just for one action. (basically for one link)

How can i ? I know i can globally turn it off but that will be the last choice.

Upvotes: 1

Views: 557

Answers (2)

Duncan Miller
Duncan Miller

Reputation: 1

You can also use a regular expression with rack-ssl-enforcer to exclude a single action.

config.middleware.use Rack::SslEnforcer, :except => ['/foo', %r{/bar$}]

This will exclude www.example.com/foo and www.example.com/items/1/bar. This can be helpful if you want to exclude just the 'bar' action for the items controller but not other actions.

Upvotes: 0

Drakkin
Drakkin

Reputation: 908

You can use the gem rack-ssl-enforcer and set this configuration line in the production configuration file :

config.middleware.use Rack::SslEnforcer, except: '/webservice'

You can replace /webservice by the link you want to disable SSL

Upvotes: 1

Related Questions