简体   繁体   中英

Traefik rewriting the http status?

I am experiencing a very strange behaviour with traefik (1.3.5) being used in kubernetes (used as ingress (deploy with the stable chart)).

I have a php endpoint behind a varnish server that returns a 404 when I curl it directly without any special trick.

$ curl -v ingress.../sport/?page=404
> GET /sport/?page=404 HTTP/1.1
> Host: varnish.ingress.xxx
> User-Agent: curl/7.43.0
> Accept: */*
>

< HTTP/1.1 404 Not Found
< Age: 0
< Cache-Control: max-age=10, public
< Content-Type: text/html; charset=UTF-8
< Date: Wed, 06 Sep 2017 21:19:48 GMT
< Server: nginx
< Vary: Accept-Encoding
< Vary: Accept-Encoding
< Via: 1.1 varnish-v4
< X-Cache: MISS
< X-Powered-By: PHP/7.1.6
< X-Varnish: 65773
< Transfer-Encoding: chunked
< 

This is the expected behavior, but when I curl it through traefik with the gzip header (or with --compressed), I have an http 200... :up_side_down:

$ curl -v ...ingress.../sport/?page=404
> GET /sport/?page=404 HTTP/1.1
> Host: varnish.ingress.xxx
> User-Agent: curl/7.43.0
> Accept: */*
> Accept-Encoding: gzip
> 

< HTTP/1.1 200 OK
< Age: 0
< Cache-Control: max-age=10, public
< Content-Encoding: gzip
< Content-Type: text/html; charset=UTF-8
< Date: Wed, 06 Sep 2017 21:18:38 GMT
< Server: nginx
< Vary: Accept-Encoding
< Vary: Accept-Encoding
< Via: 1.1 varnish-v4
< X-Cache: MISS
< X-Powered-By: PHP/7.1.6
< X-Varnish: 197657
< Transfer-Encoding: chunked
< 

If I do the same test by directly on varnish or through an amazon elb I don't have the issue and always get a 404...

I noticed that traefik is re-adding the Vary: Accept-Encoding header.

I also noticed dozen of server.go:2753: http: multiple response.WriteHeader calls log messages.

Has anyone of you already got that strange behavior ? Any clue how to investigate ?

Thanks in advance

Well, this is a known issue https://github.com/containous/traefik/pull/1948 that will be shipped in 1.4.0

M.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM