Move X-Forwarded-Port variable to the location context

Resolves issue #4038 where the X-Forwarded-Port header would be set to the value of the https listening port if all of the following settings were satisfied:
- The ingress controller was started with a non-default HTTPS port set with the `--https-port` argument
- An ingress is created having:
  - the `nginx.ingress.kubernetes.io/auth-url` annotation set
  - TLS enabled

This commit solves this issue by moving the setting of the `pass_server_port` variable from the server, one level down to the location context.
This commit is contained in:
Jeroen Schutrup 2019-05-15 15:01:48 +02:00
parent 39144bb987
commit 8dd912114e
No known key found for this signature in database
GPG key ID: A706EF3B963ADE22
9 changed files with 208 additions and 7 deletions

View file

@ -18,6 +18,7 @@ COPY e2e.sh /e2e.sh
COPY cloud-generic /cloud-generic
COPY cluster-wide /cluster-wide
COPY overlay /overlay
COPY namespace-overlays /namespace-overlays
RUN sed -E -i 's|^- .*deploy/cloud-generic$|- ../cloud-generic|' /overlay/kustomization.yaml
COPY wait-for-nginx.sh /
COPY e2e.test /

View file

@ -0,0 +1,12 @@
- op: replace
path: /spec/template/spec/containers/0/ports/0/containerPort
value: 1080
- op: replace
path: /spec/template/spec/containers/0/ports/1/containerPort
value: 1443
- op: add
path: /spec/template/spec/containers/0/args/-
value: --http-port=1080
- op: add
path: /spec/template/spec/containers/0/args/-
value: --https-port=1443

View file

@ -0,0 +1,16 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
patchesJson6902:
- target:
group: apps
version: v1
kind: Deployment
name: nginx-ingress-controller
path: deployment-patch.yaml
- target:
version: v1
kind: Service
name: ingress-nginx
path: service-patch.yaml
bases:
- ../../overlay

View file

@ -0,0 +1,6 @@
- op: replace
path: /spec/ports/0/targetPort
value: 1080
- op: replace
path: /spec/ports/1/targetPort
value: 1443