-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
after e9b1d7d commit, reverse proxy to the web page of GOGS will become garbled #3606
Comments
Could you show me how to reproduce it please? Including all the config files of Caddy and GOGS. Thank you. |
According to the http2 standard, http2 doesn't support http 1.1's chunked transfer encoding mechanism, as it provides its own, more efficient, mechanisms for data streaming. |
Yes, http2 has its own data streaming, but the main job of most people using caddy is to provide a reverse proxy for http1.1 sites and provide http2 to the browser. If caddy isn't supported to back-end sites which using http1.1 return content in chunked mode, the reverse proxy function will be restricted and disturbing. The specific problem is to reverse proxy to the latest release version 0.11.91 of Gogs, and the configuration is the simplest |
Could you show me your Caddyfile? Did you specify http transport version in config file? |
xxxx.com { |
Thank you. |
Thank you, I remember it should be #246a31a, it came to #e9b1d7d had only one commit. |
Things become strange now. Did you change other factors(caddy config? GOGS config or version? other configs?) between those two commit? I wrote a server as upstream to serve chunked data via http1.1 protocol, caddy(commit #e9b1d7d,with your config) has no problem to proxy it. Log shows caddy received chunked transfer-encoding response from upstream, and client successfully received correct data from caddy: Next, I'm gonna test GOGS as upstream server. |
I think I found the problem, and after I removed encode gzip, the problem was resolved. |
@crwnet I hope this PR could solve the problem. Thank you for your help. |
Don't mention it. I think it would be better to coding that only h2c connections are flushed immediately to solve this problem. Other types of reverse proxy are basically and not needed it, and may be the same as encoding module, several up-level modules lose their original functions. |
Yes, it might be better to restrict flushing action to h2 upstream, it only checks client protocol at the moment. |
But even if it's in |
Great discussion here so far. Thanks for working it out while I've been busy catching up. Several middleware handlers intercept the I think the change/fix for this should be as minimally invasive as possible. If it only needs to happen on h2c connections, then let's make sure it only happens on h2c connections; and even better, if the client doesn't accept any other encodings. |
Yes, the minimal invasive to fix #3556:#e9b1d7d that it should be get transport version values from reverse proxy configuration, and only the values include "h2c" then #e9b1d7d will be executed. |
Make sense. |
add a option in http like bi-stream? |
As far as I know. Haproxy doesn't need to specify "bi-stream"-like options to support v2ray as h2 upstream, you just write h2 1.1 as supported versions in haproxy, then it works like a charm. |
These are two different softwares. Their implementation strategies and module priority methods are not the same, so they will have different effects. We are discussing how to better implement all the desired functions and try to be compatible with all modes. |
Understood. |
…3620) * reverse_proxy: fix bi-h2stream breaking gzip encode handle(#3606). * reverse_proxy: check http version of both sides to avoid affecting non-h2 upstream. * Minor cleanup; apply review suggestions Co-authored-by: Matthew Holt <[email protected]>
The commit of e9b1d7d solves the #3556 issue, but may lead to new issues.
This problem may be due to the content returned by GOGS in chunked mode and lack of the Content-Length field. I am not sure whether all chunked pages are affected by this commit.
The text was updated successfully, but these errors were encountered: