This project is archived and is in readonly mode.
request.ssl? should reflect rack.url_scheme
-
David Trasbo
- State changed from new to invalid
- Importance changed from to Low
The
ssl?method was removed in http://github.com/rails/rails/commit/50215f9525b6b5e3bfe703724b9f68... - I posted a comment asking why because other methods in the same module seems to depend on it. There might be a perfectly good reason, so I'm marking this as invalid for now. -
David Trasbo
Yep, there was.
ssl?is defined in Rack. -
José Valim
Steven, this is the way both Rack and Rails check if a connection is using SSL:
http://github.com/rack/rack/blob/master/lib/rack/request.rb#L269
Not sure why Thin sets
env["rack.url_scheme"] = "https"maybe you can point to somewhere in the rack specification? -
José Valim
- State changed from invalid to open
- Assigned user set to José Valim
Hrm, actually after looking at Rack tests, I've noticed they indeed check for both "HTTPS" and "rack.url_scheme". I will check with Rack maintainers.
http://github.com/rack/rack/blob/master/test/spec_mock.rb#L106
-
Steven Parkes
Thanks, José. I suggested the patch for Thin based on ... something I saw? Can't remember where I first saw rack.url_scheme. Might have been the rack tests. Maybe Sinatra?
Anyway, once we know what's "right", I can try to make sure Thin follows suit.
Thanks!
-
José Valim
Both are valid! Can you provide a patch for Rails 3-0-stable? I will fix it in rack. :)
-
Steven Parkes
What's the rack fix? Request#ssl? looking at env["rack.url_scheme"] instead of env["HTTPS"] and env["HTTP_X_FORWARDED_PROTO"]?
Now that I'm a little more awake, rack.url_scheme is in the spec, but HTTPS and HTTP_X_FORWARDED_PROTO aren't. My interpretation is that rack clients should only look at rack.url_scheme or Request#ssl? and leave the HTTPS/HTTP_X_FORWARDED_PROTO to the rack container?
-
Jeff Kreeftmeijer
Automatic cleanup of spam.
-
Santiago Pastorino
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
Santiago Pastorino
- State changed from open to stale
-
Craig
I believe this is still an issue in Rails, at least up to 3.0.7.
Looking at url.rb (https://github.com/rails/rails/blob/3-0-7/actionpack/lib/action_dis...) you can see that the "ssl?" method doesn't take into account the "rack.url_scheme" environment setting (available through request.env['rack.url_scheme'].
However, as mentioned before, the 3.0.7 tests still use it: https://github.com/rails/rails/blob/3-0-7/actionpack/test/dispatch/...
Any thoughts?