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

Forwarder error on HTTP2 --> HTTP headers #43

Closed
Neuw84 opened this Issue May 23, 2016 · 2 comments

Comments

Projects
None yet
3 participants
@Neuw84

Neuw84 commented May 23, 2016

Hello,
If the oxy forwarder is used on HTTP2 protocol environments, the redirection does not work on Safari on Mac Os or IOs. The bug has been discovered using Traefik Proxy (see the link).

containous/traefik#307 (comment)

And seems to be related to the fact that the protocol version is manually overridden to http 1.1 , https://github.com/vulcand/oxy/blob/master/forward/fwd.go#L220

Any hints on which could be the best way to solve this?

@emilevauge

This comment has been minimized.

Show comment
Hide comment
@emilevauge

emilevauge May 23, 2016

Contributor

@Neuw84, the protocol version is not the issue here.
As I said containous/traefik#307 (comment), it is more likely to be in the headers sent back to the client.

Contributor

emilevauge commented May 23, 2016

@Neuw84, the protocol version is not the issue here.
As I said containous/traefik#307 (comment), it is more likely to be in the headers sent back to the client.

@Neuw84 Neuw84 changed the title from Forwarder error on HTTP2 protocol to Forwarder error on HTTP2/HTTP headers May 23, 2016

@Neuw84 Neuw84 changed the title from Forwarder error on HTTP2/HTTP headers to Forwarder error on HTTP2 --> HTTP headers May 23, 2016

@andersbetner

This comment has been minimized.

Show comment
Hide comment
@andersbetner

andersbetner Aug 10, 2016

I ran into this bug using Traefik proxying in front of Nginx.

  1. Safari makes a http2 request to Traefik.
  2. Traefik makes a http1.1 request to Nginx.
  3. The response from Nginx contains "Connection: keep-alive" which gets copied to the http2 response sent to Safari.

Safari goes banas and tries to get the page repeatedly a lot of times. Which the user sees as responsetimes measured in seconds. Eventually safari gives up and shows you the page.
Chrome handles it more gracefully.

Curl shows the error in plain text

curl -v --http2 https://mysite.com

* TCP_NODELAY set
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x7fa57b806200)
> GET / HTTP/1.1
> Host: mysite.com
> User-Agent: curl/7.50.1
> Accept: */*
>
* Connection state changed (MAX_CONCURRENT_STREAMS updated)!
* http2 error: Invalid HTTP header field was received: frame type: 1, stream: 1, name: [connection], value: [keep-alive]
* HTTP/2 stream 1 was not closed cleanly: PROTOCOL_ERROR (err 1)
* Connection #0 to host mysite.com left intact
curl: (92) HTTP/2 stream 1 was not closed cleanly: PROTOCOL_ERROR (err 1)

If I disable keep-alive in Nginx keepalive_timeout 0s; it works like a charm.

So I guess the connection header should be removed by Oxy when proxying from http1.1 to http2.

I have tcpdump logs if that helps.

andersbetner commented Aug 10, 2016

I ran into this bug using Traefik proxying in front of Nginx.

  1. Safari makes a http2 request to Traefik.
  2. Traefik makes a http1.1 request to Nginx.
  3. The response from Nginx contains "Connection: keep-alive" which gets copied to the http2 response sent to Safari.

Safari goes banas and tries to get the page repeatedly a lot of times. Which the user sees as responsetimes measured in seconds. Eventually safari gives up and shows you the page.
Chrome handles it more gracefully.

Curl shows the error in plain text

curl -v --http2 https://mysite.com

* TCP_NODELAY set
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x7fa57b806200)
> GET / HTTP/1.1
> Host: mysite.com
> User-Agent: curl/7.50.1
> Accept: */*
>
* Connection state changed (MAX_CONCURRENT_STREAMS updated)!
* http2 error: Invalid HTTP header field was received: frame type: 1, stream: 1, name: [connection], value: [keep-alive]
* HTTP/2 stream 1 was not closed cleanly: PROTOCOL_ERROR (err 1)
* Connection #0 to host mysite.com left intact
curl: (92) HTTP/2 stream 1 was not closed cleanly: PROTOCOL_ERROR (err 1)

If I disable keep-alive in Nginx keepalive_timeout 0s; it works like a charm.

So I guess the connection header should be removed by Oxy when proxying from http1.1 to http2.

I have tcpdump logs if that helps.

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