-
Notifications
You must be signed in to change notification settings - Fork 97
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
Infinite redirects behind AWS ELB #82
Comments
I am not familiar with AWS ELB, but setting [1] X-Forwarded-Proto as described in [2] might help... [1] https://github.com/tobmatth/rack-ssl-enforcer#nginx |
@tobmatth, I'll give that a try later today and keep this thread updated! |
For all those behind AWS ELB, this what what did it for us. config.middleware.use Rack::SslEnforcer,
# this ignores elb healthchecks and development env
# elb healthchecks aren't forwarded requests, so it wouldn't have forwarded proto
# same goes when running without a proxy (like dev locally)
ignore: lambda { |request| request.env["HTTP_X_FORWARDED_PROTO"].blank? },
strict: true |
Glad you figured it out. Just merged your PR, thanks! |
No problem! I'm hoping it'll at the very least point people in the right direction. And for those behind Amazon ELB specifically, they'll be able to copy and paste and be on their way! :) |
Pretty sure I have NGINX config correct.
Started with
config.middleware.use Rack::SslEnforcer, :except_environments => 'development', :except => [/.*\/demo$/, /.*\/preview$/, /.*\/debug$/], :force_secure_cookies => false, :strict => true
, and wasn't hitting AWS ELB.So I decided to take baby steps instead...
Switched over to
config.middleware.use Rack::SslEnforcer, :redirect_to => "http(s)://project_url"
as proposed by the behind a proxy section, and found out that ELB wasn't able to pass health checks because they are always done via http.So I added
:except_agents => 'ELB-HealthChecker/1.0'
in order to exempt the ELB health checks, and am now getting redirects again.I'm going to resume solving this tomorrow with fresh idea, but any help would be appreciated!
The text was updated successfully, but these errors were encountered: