Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails SSL Requirement plugin -- shouldn't it check to see if you're in production mode before redirecting to https?

Take a look at the ssl_requirement plugin.

Shouldn't it check to see if you're in production mode? We're seeing a redirect to https in development mode, which seems odd. Or is that the normal behavior for the plugin? I thought it behaved differently in the past.

like image 200
Joe Van Dyk Avatar asked Dec 30 '22 10:12

Joe Van Dyk


2 Answers

I guess they believe that you should probably be using HTTPS (perhaps with a self-signed certificate) in development mode. If that's not the desired behaviour, there's nothing stopping you from special casing SSL behaviour in the development environment yourself:

class YourController < ApplicationController
  ssl_required :update unless Rails.env.development?
end
like image 146
Nathan de Vries Avatar answered Jan 04 '23 17:01

Nathan de Vries


  def ssl_required?
    return false if local_request? || RAILS_ENV == 'test' || RAILS_ENV == 'development'
    super
  end
like image 34
Anatoly Avatar answered Jan 04 '23 17:01

Anatoly