Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Request#scheme SSL headers #534
One of our customers has a setup with proxies that route requests internally over http. Instead of any of the headers defined in Request#scheme (https://github.com/rack/rack/blob/master/lib/rack/request.rb#L70), the HTTP_X_HTTPS is sent. I've monkey-patched the method by checking for @env['HTTP_X_HTTPS'] == 'true'.
As I'm not sure how common this header is (Google returns only a few results), I don't think this case should be added to the method, but I think it would be nice if custom SSL headers could be configured somehow without monkey-patching the method.
This comment has been minimized.
This comment has been minimized.Show comment Hide comment
Yeah... it is actually about a rails app. Rails already subclasses Rack::Request with ActionDispatch:Request, which I cannot substitute with my own class. I just thought that it would be nice if the massive if-block could be refactored to something more elegant and extendible. I'll stick with the monkeypatch for now.
There's no way to make it "extensible" in the way that you're talking about. In the same way that you're not in control of the type being created, you're also not in control of the options it would be constructed with.
You probably have some global singleton approach in mind, which is not an approach that we take.