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 rewrite-target Annotation behavior #3582

Merged
merged 1 commit into from Jul 9, 2018
Merged

Conversation

dtomcej
Copy link
Contributor

@dtomcej dtomcej commented Jul 9, 2018

What does this PR do?

Corrects incorrect rewrite-target behavior

Motivation

Fixes #3566

More

  • Added/updated tests
  • Added/updated documentation - Not needed, as this corrects unintended behavior

Additional Notes

This ingress:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: whoami
  annotations:
     traefik.ingress.kubernetes.io/rewrite-target: /demo
spec:
  rules:
  - host: localhost
    http:
      paths:
      - path: /testing
        backend:
          serviceName: whoami
          servicePort: http

Now correctly rewrites the target request:

$ curl -v localhost:30183/testing/bacon/index.php?something
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 30183 (#0)
> GET /testing/bacon/index.php?something HTTP/1.1
> Host: localhost:30183
> User-Agent: curl/7.54.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< Content-Length: 442
< Content-Type: text/plain; charset=utf-8
< Date: Mon, 09 Jul 2018 17:02:12 GMT
< 
Hostname: whoami-7fbb4599b4-m5k4h
IP: 127.0.0.1
IP: 10.1.1.18
GET /demo/bacon/index.php?something HTTP/1.1
Host: localhost:30183
User-Agent: curl/7.54.0
Accept: */*
Accept-Encoding: gzip
X-Forwarded-For: 192.168.65.3
X-Forwarded-Host: localhost:30183
X-Forwarded-Port: 30183
X-Forwarded-Proto: http
X-Forwarded-Server: traefik-ingress-controller-84869bf64-nlhxb
X-Real-Ip: 192.168.65.3
X-Replaced-Path: /testing/bacon/index.php

* Connection #0 to host localhost left intact

Copy link
Member

@ldez ldez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@juliens juliens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants