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

Can it support reverse proxy such as nginx? #7

Open
jm33-m0 opened this issue Jul 14, 2020 · 10 comments
Open

Can it support reverse proxy such as nginx? #7

jm33-m0 opened this issue Jul 14, 2020 · 10 comments

Comments

@jm33-m0
Copy link
Contributor

jm33-m0 commented Jul 14, 2020

When I put the server behind nginx, and try to connect with h2.Connect(), it throws an error:

stream error: stream ID 3; PROTOCOL_ERROR
@jm33-m0
Copy link
Contributor Author

jm33-m0 commented Jul 14, 2020

In the mean time, doing a normal GET over HTTP2 client works fine

@posener
Copy link
Owner

posener commented Jul 14, 2020

Does it work for you if you directly connect to the server, and not through nginx?
Can you give more information? I can't tell too much from the two lines in the bug description.

@jm33-m0
Copy link
Contributor Author

jm33-m0 commented Jul 14, 2020

It works well without nginx, it's an issue with nginx support I think
Also, it's the same error if put behind Cloudflare CDN

@jm33-m0
Copy link
Contributor Author

jm33-m0 commented Jul 14, 2020

My code:

	// use h2conn for duplex tunnel
	ctx, cancel = context.WithCancel(context.Background())

	h2 := h2conn.Client{Client: HTTPClient}

	conn, resp, err = h2.Connect(ctx, url)
	if err != nil {
		log.Printf("Initiate conn: %s", err)
		return
	}

@jm33-m0
Copy link
Contributor Author

jm33-m0 commented Jul 14, 2020

Additional info: nginx returns code 408:

A 408 Request Timeout response code indicates that the server did not receive a complete request from the client within a specific period of time tracked by the server (i.e. the timeout period).

@posener
Copy link
Owner

posener commented Jul 14, 2020

Did you configure nginx to support http2?

@jm33-m0
Copy link
Contributor Author

jm33-m0 commented Jul 14, 2020

Yes, http2 is enabled, and normal requests via HTTP2 work fine

@posener
Copy link
Owner

posener commented Jul 16, 2020

Sorry, it will be very hard for me to debug this.
Please look at nginx logs, or use tcpdump/wireshark to debug the connection.
If you find anything there it will be very interesting, and see if we can work on a fix to the library.

@andrew-mestas
Copy link

@jm33-m0 Have you found out the solution? If not, can you post your nginx configuration and output of curl -I -L https://your_domain?

@jm33-m0
Copy link
Contributor Author

jm33-m0 commented Sep 18, 2020

I encapsulated the HTTP2 connection in a proxy, didn't try to solve the nginx (or any kind of reverse proxy) support.

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

No branches or pull requests

3 participants