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

@ -88,9 +88,9 @@ func (f *Framework) ExecCommand(pod *corev1.Pod, command string) (string, error)
}
// NewIngressController deploys a new NGINX Ingress controller in a namespace
func (f *Framework) NewIngressController(namespace string) error {
func (f *Framework) NewIngressController(namespace string, namespaceOverlay string) error {
// Creates an nginx deployment
cmd := exec.Command("./wait-for-nginx.sh", namespace)
cmd := exec.Command("./wait-for-nginx.sh", namespace, namespaceOverlay)
out, err := cmd.CombinedOutput()
if err != nil {
return fmt.Errorf("Unexpected error waiting for ingress controller deployment: %v.\nLogs:\n%v", err, string(out))

View file

@ -103,7 +103,7 @@ func (f *Framework) BeforeEach() {
f.Namespace = ingressNamespace
By("Starting new ingress controller")
err = f.NewIngressController(f.Namespace)
err = f.NewIngressController(f.Namespace, f.BaseName)
Expect(err).NotTo(HaveOccurred())
err = WaitForPodsReady(f.KubeClientSet, DefaultTimeout, 1, f.Namespace, metav1.ListOptions{