Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working on Heroku? #35

Closed
iesta opened this issue Apr 12, 2012 · 3 comments
Closed

Working on Heroku? #35

iesta opened this issue Apr 12, 2012 · 3 comments

Comments

@iesta
Copy link

iesta commented Apr 12, 2012

I am trying to get the enforcer to work on heroku but it does not work :

config.middleware.use Rack::SslEnforcer, :only => %r{^/cart_items/}, :strict => true, :force_secure_cookies => false

I also have tried with simpler version :

config.middleware.use Rack::SslEnforcer, :only => %r{^/cart_items/}

SSL works work if redirected through rails

Any idea?

@thibaudgg
Copy link
Collaborator

Can you run heroku run rake middleware to see where Rack::SslEnforcer is placed. It's important to place it at the top (i.e.: before Rack::Cache)

config.middleware.insert_before Rack::Cache, Rack::SslEnforcer, ...

@iesta
Copy link
Author

iesta commented Apr 12, 2012

Thanks a lot for your fast response
Ok now i understand a lot more about Rack
It is working great

I used :

config.middleware.insert_before ActionDispatch::Static, Rack::SslEnforcer, :only => '/cart_items', :strict => true

I don't know if it's really the best (and optimized) solution.

Here is my order of rack modules :

use Rack::Rewrite
use Rack::SslEnforcer
use ActionDispatch::Static
use Rack::Lock
use Rack::Runtime
use Rack::MethodOverride
use ActionDispatch::RequestId
use Rails::Rack::Logger
use ActionDispatch::ShowExceptions
use ActionDispatch::DebugExceptions
use ActionDispatch::RemoteIp
use Rack::Sendfile
use ActionDispatch::Callbacks
use ActiveRecord::ConnectionAdapters::ConnectionManagement
use ActiveRecord::QueryCache
use ActionDispatch::Cookies
use ActionDispatch::Session::CookieStore
use ActionDispatch::Flash
use ActionDispatch::ParamsParser
use ActionDispatch::Head
use Rack::ConditionalGet
use Rack::ETag
use ActionDispatch::BestStandardsSupport
use Warden::Manager
run Sk8::Application.routes

@rymai
Copy link
Collaborator

rymai commented Apr 12, 2012

I think it's good like this!

@rymai rymai closed this as completed Apr 12, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants