Help with force_ssl

Hi, I’d like to force_ssl on all the requests on my application, but not
when the subdomain user is foo. How can I do this?
The best way would be something like (in the application controller):

force_ssl :unless => proc {|request| request.subdomain == ‘foo’}

But from what I read from the doc (
http://api.rubyonrails.org/classes/ActionController/ForceSSL/ClassMethods.html#method-i-force_ssl
) the only options are “only” and “except” for the given actions.

Any hint?

On 03/27/2012 06:05 PM, eduardo altrez wrote:

Any hint?

you can use before filter or enviroment.rb file that if request is
having sub domain use https"//

for before filter you can use like this

def secure_with_ssl
if request.subdomain == ‘foo’
redirect_to :subdomain => ‘foo’, :protocol => ‘http://’
end
end

put before_filter :secure_with_ssl in application controller