Commit 27b1ea5
committed
Drop incorrect port
`Rack::Request#url` includes the port of the original request (despite
accurate scheme updates). This becomes an issue when LB terminates SSL:
- client request is made to https://example.com:443,
- LB request is http://example.com:80
- build_api_url returns correct scheme but wrong port:
https://example:80
Since we only need the request url from the env, this changeset manually
fetches the correct scheme (Rack accounts for FWD headers already), the
host (w/out port as opposed to #host_with_port), and the fullpath
(pathname + query params)
Another benefit of this changeset is that it no longer mutates the
original env object (assigning to `new_env` is by reference).
Caveat: im dropping @options[:protocol] bc there's x-fwd-proto should
handle this already.1 parent 5a786a5 commit 27b1ea5
1 file changed
+2
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | | - | |
185 | 184 | | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
| 185 | + | |
| 186 | + | |
204 | 187 | | |
205 | 188 | | |
206 | 189 | | |
207 | 190 | | |
208 | 191 | | |
209 | | - | |
210 | 192 | | |
211 | 193 | | |
212 | 194 | | |
| |||
0 commit comments