-
Notifications
You must be signed in to change notification settings - Fork 228
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
Caddy shows "ResponseWriter doesn't implement http.Flusher" when enable access log and connect to a proxy server using HTTP/2 #107
Comments
Ah yeah, sorry about this. We didn't know this would be a breaking change, as Go recently introduced the |
Replace type-asserting to ResponseController simply, Caddy doesn't log "ResponseWriter doesn't implement http.Flusher" error, but still can't connected to website througth HTTPS proxy server. --- old/forwardproxy/forwardproxy.go 2023-08-18 16:29:35.315551349 +0800
+++ new/forwardproxy/forwardproxy.go 2023-08-18 16:27:56.808116573 +0800
@@ -309,13 +309,12 @@ func (h *Handler) ServeHTTP(w http.Respo
fallthrough
case 3:
defer r.Body.Close()
- wFlusher, ok := w.(http.Flusher)
- if !ok {
- return caddyhttp.Error(http.StatusInternalServerError,
- fmt.Errorf("ResponseWriter doesn't implement http.Flusher"))
- }
+ wController := http.NewResponseController(w)
w.WriteHeader(http.StatusOK)
- wFlusher.Flush()
+ err := wController.Flush()
+ if err != nil {
+ return caddyhttp.Error(http.StatusInternalServerError, fmt.Errorf(err.Error()))
+ }
return dualStream(targetConn, r.Body, w)
} |
Should be fixed after #74. |
@jerry-wolf Do you want to try again now with the latest commits? |
1. Is bug reproducible with latest
forwardproxy
build?2. What are you trying to do?
Run a forward proxy, and log request info (remote_ip, host, timestamp, etc).
3. What is your entire Caddyfile?
4. How is your client configured?
chrome --proxy-server=https://example.com
5. How did you run Caddy? (give the full command and describe the execution environment). If multiple servers are used (for example with
upstream
), describe those as well.Ubuntu 22.04.
systemctl start caddy
Installed following [this article](Installed following this article fragment), and use xcaddy to build custom caddy.
Here is build info:
6. Please paste any relevant HTTP request(s) here.
7. What did you expect to see?
Connected to website througth HTTPS proxy server.
8. What did you see instead (give full error messages and/or log)?
Chrome shows ERR_TUNNEL_CONNECTION_FAILED.
Server log:
9. How can someone who is starting from scratch reproduce the bug as minimally as possible?
Make sure to use HTTP/2 to connect to the proxy server. Make sure to use the log directive in the site block. Maybe it's easier to reproduce using a non-default port.
The text was updated successfully, but these errors were encountered: