Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Request#scheme SSL headers #534

moiristo opened this Issue · 3 comments

2 participants


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 (, 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.

class MyRequest < Rack::Request
  def scheme
    @env['HTTP_X_HTTPS'] == 'true' || super
@raggi raggi closed this

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.