8000 Support over-ride of default client proxy headers · Issue #3219 · nginx/kubernetes-ingress · GitHub
[go: up one dir, main page]

Skip to content

Support over-ride of default client proxy headers #3219

@brianehlert

Description

@brianehlert

When using the VirtualServer CRD, If you attempt to set any of the headers that are included by default in the temapltes, you end of with duplicate headers.
This is limited to the subset of headers that are included by default to support http and grpc.

For example:

X-Real-IP
X-Forwarded-For
X-Forwarded-Host
X-Forwarded-Port
X-Forwarded-Proto
For example:

  - action:
      proxy:
        requestHeaders:
          set:
            - name: X-Forwarded-For
              value: ${http_cf_connecting_ip}
            - name: X-Forwarded-Proto
              value: ${scheme}-foo

Will result in the following:

        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Port $server_port;
        proxy_set_header X-Forwarded-Proto $scheme;

        proxy_set_header X-Forwarded-For "${http_cf_connecting_ip}";

        proxy_set_header X-Forwarded-Proto "${scheme}-foo";

This causes the headers to be sent upstream twice: once with the default value and once with the defined value.
This change prevents the duplication from happening for the included headers and gives precedence to the defined value (over the default).

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalAn issue that proposes a feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0