Set proxy host header to the exact value of the request host header #827
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed changes
Problem: The Gateway API expects the response host header to match the exact value of the request host header. We set the proxy host header to the
$host
nginx variable, which does not include any characters after:
. This causes a conformance test to fail where the host header contains a port.Solution: Set the proxy host header to
$http_host
nginx variable when it is non-empty. This variable contains the unmodified host header of the request. However, in an HTTP/1.0 request, it's possible that$http_host
can be empty. In this case, we will use the value of$host
. See http://nginx.org/en/docs/http/ngx_http_core_module.html#var_host.Testing: Ran impacted conformance test
Closes #797
Checklist
Before creating a PR, run through this checklist and mark each as complete.