Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix setting host header in action proxy in VirtualServer/VirtualServerRoute #1444

Merged
merged 2 commits into from
Mar 11, 2021

Conversation

pleshakov
Copy link
Contributor

Proposed changes

Previously, a configuration like below will make NGINX send two host headers to the backend - the default "$host" and the configured "bar.example.com":

apiVersion: k8s.nginx.org/v1
kind: VirtualServer
metadata:
  name: foo 
spec:
  host: foo.example.com
  upstreams:
  - name: foo
    port: 8080
    service: backend-svc
  routes:
  - path: "/"
    action:
      proxy:
        upstream: foo
        requestHeaders:
          set:
          - name: Host
            value: bar.example.com

Now NGINX will only send one host header: by default - "$host", or the one configured in requestHeaders

I also updated some of the tests to print diffs. Otherwise, it was hard to see the mismatch in results.

@github-actions github-actions bot added bug An issue reporting a potential bug documentation Pull requests/issues for documentation labels Mar 11, 2021
internal/configs/virtualserver.go Outdated Show resolved Hide resolved
@pleshakov pleshakov merged commit dd0aca7 into master Mar 11, 2021
@pleshakov pleshakov deleted the fix-headers branch March 11, 2021 20:00
@pleshakov pleshakov changed the title Fix setting host header in action proxy Fix setting host header in action proxy in VirtualServer/VirtualServerRoute Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue reporting a potential bug documentation Pull requests/issues for documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants