Skip to content

Commit 44bd334

Browse files
committed
Add x_forwarded_host, which will forward the original Host header using the X-Forwarded-Host request header
This way, the origin server can optionally use that value to generate absolute URLs, etc.
1 parent c174271 commit 44bd334

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/rack/reverse_proxy.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def call(env)
2424
end
2525
}
2626
headers['HOST'] = uri.host if all_opts[:preserve_host]
27+
headers['X-Forwarded-Host'] = rackreq.host if all_opts[:x_forwarded_host]
2728

2829
session = Net::HTTP.new(uri.host, uri.port)
2930
session.read_timeout=all_opts[:timeout] if all_opts[:timeout]

0 commit comments

Comments
 (0)