Skip to content

Commit

Permalink
Try moving forwarded proto support after header unwrap
Browse files Browse the repository at this point in the history
  • Loading branch information
jellybob committed Nov 12, 2019
1 parent ad0c43e commit 70f79c3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/falcon/adapters/rack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,6 @@ def unwrap_request(request, env)
def call(request)
request_path, query_string = request.path.split('?', 2)
server_name, server_port = (request.authority || '').split(':', 2)

unless request.headers["x-forwarded-proto"].nil?
request.scheme = request.headers["x-forwarded-proto"].first
end

env = {
RACK_VERSION => [2, 0, 0],
Expand Down Expand Up @@ -161,6 +157,11 @@ def call(request)
}

self.unwrap_request(request, env)

unless request.headers["x-forwarded-proto"].nil?
request.scheme = request.headers["x-forwarded-proto"].first
env[RACK_URL_SCHEME] = request.scheme
end

if request.push?
env[RACK_EARLY_HINTS] = EarlyHints.new(request)
Expand Down

0 comments on commit 70f79c3

Please sign in to comment.