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

Caddy shows "ResponseWriter doesn't implement http.Flusher" when enable access log and connect to a proxy server using HTTP/2 #107

Open
jerry-wolf opened this issue Aug 17, 2023 · 4 comments

Comments

@jerry-wolf
Copy link

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?

https://:8443, https://example.com:8443 {
	route {
		forward_proxy {
			hide_ip
			hide_via
		}
	}
	log {
		format json
	}
}

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:

go	go1.20.7
path	caddy
mod	caddy	(devel)	
dep	clevergo.tech/caddy-dnspodcn	v0.1.0
=>	/home/tommy/caddy-dnspodcn	(devel)	

dep	clevergo.tech/dnspodcn	v0.1.1	h1:0D8hKcHXpG4/O9A3K+jghPYmty8FPumbOOVrJM0DjGQ=
dep	filippo.io/edwards25519	v1.0.0	h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek=
dep	github.com/AndreasBriese/bbloom	v0.0.0-20190825152654-46b345b51c96	h1:cTp8I5+VIoKjsnZuH8vjyaysT/ses3EvZeaV/1UkF2M=
dep	github.com/BurntSushi/toml	v1.3.2	h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8=
dep	github.com/Masterminds/goutils	v1.1.1	h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
dep	github.com/Masterminds/semver/v3	v3.2.1	h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0=
dep	github.com/Masterminds/sprig/v3	v3.2.3	h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA=
dep	github.com/RoaringBitmap/roaring	v1.2.3	h1:yqreLINqIrX22ErkKI0vY47/ivtJr6n+kMhVOVmhWBY=
dep	github.com/abiosoft/caddy-json-schema	v0.0.0-20220621031927-c4d6e132f3af	h1:ZfOWMEpjgZmXo2Vz+KgCBue3rr0PDefCZLdd+N4vM3o=
dep	github.com/alecthomas/chroma/v2	v2.7.0	h1:hm1rY6c/Ob4eGclpQ7X/A3yhqBOZNUTk9q+yhyLIViI=
dep	github.com/andybalholm/brotli	v1.0.5	h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs=
dep	github.com/antlr/antlr4/runtime/Go/antlr/v4	v4.0.0-20230305170008-8188dc5388df	h1:7RFfzj4SSt6nnvCPbCqijJi1nWCd+TqAT3bYCStRC18=
dep	github.com/armon/go-metrics	v0.4.1	h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJA=
dep	github.com/aryann/difflib	v0.0.0-20210328193216-ff5ff6dc229b	h1:uUXgbcPDK3KpW29o4iy7GtuappbWT0l5NaMo9H9pJDw=
dep	github.com/beorn7/perks	v1.0.1	h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
dep	github.com/buraksezer/consistent	v0.10.0	h1:hqBgz1PvNLC5rkWcEBVAL9dFMBWz6I0VgUCW25rrZlU=
dep	github.com/buraksezer/olric	v0.5.4	h1:LDgLIfVoyol4qzdNirrrDUKqzFw0yDsa7ukvLrpP4cU=
dep	github.com/bwmarrin/snowflake	v0.3.0	h1:xm67bEhkKh6ij1790JB83OujPR5CzNe8QuQqAgISZN0=
dep	github.com/caddy-dns/alidns	v1.0.23	h1:B2JSeQrx2S3xgO5bte7SANmBhyoFfSd9v/Blo631gRc=
dep	github.com/caddyserver/cache-handler	v0.8.0	h1:g83OyPR2FvUh08fZ1wzGm19mgu0D+96k76mJIfgrA7w=
dep	github.com/caddyserver/caddy/v2	v2.7.3	h1:eMCNjOyMgB5A1KgOzT2dXKR4I0Va+YHCJYC8HHu+DP0=
dep	github.com/caddyserver/certmagic	v0.19.1	h1:4jyOYm2DHvQI8YM0sk6qm62Gl5XznHxiMBMWjMTlQkw=
dep	github.com/caddyserver/forwardproxy	v0.0.0-20211013034647-8c6ef2bd4a8f
=>	/home/tommy/forwardproxy	(devel)	

dep	github.com/caddyserver/replace-response	v0.0.0-20230515181842-d7523f42f84a	h1:pGJv/eGQwYYByoie8ao2SoyTJcN8DrUsT5YeJZxLq3I=
dep	github.com/cenkalti/backoff/v4	v4.2.1	h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM=
dep	github.com/cespare/xxhash	v1.1.0	h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
dep	github.com/cespare/xxhash/v2	v2.2.0	h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
dep	github.com/chzyer/readline	v1.5.1	h1:upd/6fQk4src78LMRzh5vItIt361/o4uq553V8B5sGI=
dep	github.com/coreos/go-semver	v0.3.1	h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4=
dep	github.com/coreos/go-systemd/v22	v22.5.0	h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs=
dep	github.com/cpuguy83/go-md2man/v2	v2.0.2	h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
dep	github.com/darkweak/go-esi	v0.0.5	h1:b9LHI8Tz46R+i6p8avKPHAIBRQUCZDebNmKm5w/Zrns=
dep	github.com/darkweak/souin	v1.6.39	h1:uVO18+pvy5N8dJH+CCfuBD3gx7AXWaBv+RjC9ee1pCk=
dep	github.com/dgraph-io/badger	v1.6.2	h1:mNw0qs90GVgGGWylh0umH5iag1j6n/PeJtNvL6KY/x8=
dep	github.com/dgraph-io/badger/v2	v2.2007.4	h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o=
dep	github.com/dgraph-io/badger/v3	v3.2103.5	h1:ylPa6qzbjYRQMU6jokoj4wzcaweHylt//CH0AKt0akg=
dep	github.com/dgraph-io/ristretto	v0.1.1	h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8=
dep	github.com/dgryski/go-farm	v0.0.0-20200201041132-a6ae2369ad13	h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y=
dep	github.com/dgryski/go-rendezvous	v0.0.0-20200823014737-9f7001d12a5f	h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
dep	github.com/dlclark/regexp2	v1.7.0	h1:7lJfhqlPssTb1WQx4yvTHN0uElPEv52sbaECrAQxjAo=
dep	github.com/dustin/go-humanize	v1.0.1	h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
dep	github.com/felixge/httpsnoop	v1.0.3	h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk=
dep	github.com/fxamacker/cbor/v2	v2.4.0	h1:ri0ArlOR+5XunOP8CRUowT0pSJOwhW098ZCUyskZD88=
dep	github.com/go-chi/chi	v4.1.2+incompatible	h1:fGFk2Gmi/YKXk0OmGfBh0WgmN3XB8lVnEyNz34tQRec=
dep	github.com/go-kit/kit	v0.12.0	h1:e4o3o3IsBfAKQh5Qbbiqyfu97Ku7jrO/JbohvztANh4=
dep	github.com/go-kit/log	v0.2.1	h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU=
dep	github.com/go-logfmt/logfmt	v0.6.0	h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4=
dep	github.com/go-logr/logr	v1.2.4	h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
dep	github.com/go-logr/stdr	v1.2.2	h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
dep	github.com/go-redis/redis/v8	v8.11.5	h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI=
dep	github.com/go-sql-driver/mysql	v1.7.1	h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI=
dep	github.com/gogo/protobuf	v1.3.2	h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
dep	github.com/golang/glog	v1.1.1	h1:jxpi2eWoU84wbX9iIEyAeeoac3FLuifZpY9tcNUD9kw=
dep	github.com/golang/groupcache	v0.0.0-20210331224755-41bb18bfe9da	h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
dep	github.com/golang/protobuf	v1.5.3	h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
dep	github.com/golang/snappy	v0.0.4	h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
dep	github.com/google/btree	v1.1.2	h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU=
dep	github.com/google/cel-go	v0.17.1	h1:s2151PDGy/eqpCI80/8dl4VL3xTkqI/YubXLXCFw0mw=
dep	github.com/google/certificate-transparency-go	v1.1.4	h1:hCyXHDbtqlr/lMXU0D4WgbalXL0Zk4dSWWMbPV8VrqY=
dep	github.com/google/flatbuffers	v23.3.3+incompatible	h1:5PJI/WbJkaMTvpGxsHVKG/LurN/KnWXNyGpwSCDgen0=
dep	github.com/google/go-tpm	v0.3.3	h1:P/ZFNBZYXRxc+z7i5uyd8VP7MaDteuLZInzrH2idRGo=
dep	github.com/google/go-tspi	v0.3.0	h1:ADtq8RKfP+jrTyIWIZDIYcKOMecRqNJFOew2IT0Inus=
dep	github.com/google/uuid	v1.3.0	h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
dep	github.com/grpc-ecosystem/grpc-gateway/v2	v2.11.3	h1:lLT7ZLSzGLI08vc9cpd+tYmNWjdKDqyr/2L+f6U12Fk=
dep	github.com/hairyhenderson/caddy-teapot-module	v0.0.2	h1:POfr7XzYFIUEzAR5/f1+LZ9sN33GqG7XyscWljyFu5Y=
dep	github.com/hashicorp/errwrap	v1.1.0	h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
dep	github.com/hashicorp/go-immutable-radix	v1.3.1	h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc=
dep	github.com/hashicorp/go-msgpack	v0.5.5	h1:i9R9JSrqIz0QVLz3sz+i3YJdT7TTSLcfLLzJi9aZTuI=
dep	github.com/hashicorp/go-multierror	v1.1.1	h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
dep	github.com/hashicorp/go-sockaddr	v1.0.2	h1:ztczhD1jLxIRjVejw8gFomI1BQZOe2WoVOu0SyteCQc=
dep	github.com/hashicorp/golang-lru	v0.5.5-0.20200511160909-eb529947af53	h1:mcyf48FjrlX8JRXvy5v3LPeXBv+Um6WvoKS+kknfgIk=
dep	github.com/hashicorp/logutils	v1.0.0	h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y=
dep	github.com/hashicorp/memberlist	v0.5.0	h1:EtYPN8DpAURiapus508I4n9CzHs2W+8NZGbmmR/prTM=
dep	github.com/huandu/xstrings	v1.4.0	h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU=
dep	github.com/icholy/replace	v0.6.0	h1:EBiD2pGqZIOJAbEaf/5GVRaD/Pmbb4n+K3LrBdXd4dw=
dep	github.com/imdario/mergo	v0.3.16	h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4=
dep	github.com/jackc/chunkreader/v2	v2.0.1	h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8=
dep	github.com/jackc/pgconn	v1.14.1	h1:smbxIaZA08n6YuxEX1sDyjV/qkbtUtkH20qLkR9MUR4=
dep	github.com/jackc/pgio	v1.0.0	h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE=
dep	github.com/jackc/pgpassfile	v1.0.0	h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
dep	github.com/jackc/pgproto3/v2	v2.3.2	h1:7eY55bdBeCz1F2fTzSz69QC+pG46jYq9/jtSPiJ5nn0=
dep	github.com/jackc/pgservicefile	v0.0.0-20221227161230-091c0ba34f0a	h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk=
dep	github.com/jackc/pgtype	v1.14.0	h1:y+xUdabmyMkJLyApYuPj38mW+aAIqCe5uuBB51rH3Vw=
dep	github.com/jackc/pgx/v4	v4.18.1	h1:YP7G1KABtKpB5IHrO9vYwSrCOhs7p3uqhvhhQBptya0=
dep	github.com/klauspost/compress	v1.16.7	h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I=
dep	github.com/klauspost/cpuid/v2	v2.2.5	h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg=
dep	github.com/libdns/alidns	v1.0.2-x2	h1:KwuC1AmihOJjoFWXFRFaQx1PcD/jRpY04jo7yNK5zfk=
dep	github.com/libdns/libdns	v0.2.1	h1:Wu59T7wSHRgtA0cfxC+n1c/e+O3upJGWytknkmFEDis=
dep	github.com/manifoldco/promptui	v0.9.0	h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA=
dep	github.com/mastercactapus/proxyprotocol	v0.0.4	h1:qSY75IZF30ZqIU9iW1ip3I7gTnm8wRAnGWqPxCBVgq0=
dep	github.com/mattn/go-colorable	v0.1.13	h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
dep	github.com/mattn/go-isatty	v0.0.19	h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
dep	github.com/matttproud/golang_protobuf_extensions	v1.0.4	h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
dep	github.com/mgutz/ansi	v0.0.0-20200706080929-d51e80ef957d	h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI=
dep	github.com/mholt/acmez	v1.2.0	h1:1hhLxSgY5FvH5HCnGUuwbKY2VQVo8IU7rxXKSnZ7F30=
dep	github.com/mholt/caddy-l4	v0.0.0-20230809152347-4e8aaac46581	h1:0RuIMAfc++JOrTWmP5ZUNkQk0XS+DOu/2m8H/E1xsqE=
dep	github.com/mholt/caddy-webdav	v0.0.0-20221206035947-75a603bc6978	h1:+yiDdLr2PPZZHSwuOBYf8ACRA4waDw+YVp/Jgbeuo0Y=
dep	github.com/micromdm/scep/v2	v2.1.0	h1:2fS9Rla7qRR266hvUoEauBJ7J6FhgssEiq2OkSKXmaU=
dep	github.com/miekg/dns	v1.1.55	h1:GoQ4hpsj0nFLYe+bWiCToyrBEJXkQfOOIvFGFy0lEgo=
dep	github.com/mitchellh/copystructure	v1.2.0	h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
dep	github.com/mitchellh/go-ps	v1.0.0	h1:i6ampVEEF4wQFF+bkYfwYgY+F/uYJDktmvLPf7qIgjc=
dep	github.com/mitchellh/reflectwalk	v1.0.2	h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
dep	github.com/pkg/errors	v0.9.1	h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
dep	github.com/pquerna/cachecontrol	v0.1.1-0.20230415224848-baaf0ee61529	h1:wcNVCAIsWcLpEJ5FhXHKC7dBi6SIZQukrOTY5eHes0M=
dep	github.com/prometheus/client_golang	v1.16.0	h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8=
dep	github.com/prometheus/client_model	v0.4.0	h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY=
dep	github.com/prometheus/common	v0.44.0	h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY=
dep	github.com/prometheus/procfs	v0.11.1	h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI=
dep	github.com/quic-go/qpack	v0.4.0	h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo=
dep	github.com/quic-go/qtls-go1-20	v0.3.1	h1:O4BLOM3hwfVF3AcktIylQXyl7Yi2iBNVy5QsV+ySxbg=
dep	github.com/quic-go/quic-go	v0.37.3	h1:pkHH3xaMNUNAh6OtgEV/0K6Fz+YIJXhPzgd/ShiRDm4=
dep	github.com/redis/go-redis/v9	v9.0.2	h1:BA426Zqe/7r56kCcvxYLWe1mkaz71LKF77GwgFzSxfE=
dep	github.com/rs/xid	v1.5.0	h1:mKX4bl4iPYJtEIxp6CYiUuLQ/8DYMoz0PUdtGgMFRVc=
dep	github.com/russross/blackfriday/v2	v2.1.0	h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
dep	github.com/sean-/seed	v0.0.0-20170313163322-e2103e2c3529	h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I=
dep	github.com/shopspring/decimal	v1.3.1	h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
dep	github.com/shurcooL/sanitized_anchor_name	v1.0.0	h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
dep	github.com/sirupsen/logrus	v1.9.3	h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
dep	github.com/slackhq/nebula	v1.7.2	h1:Rko1Mlksz/nC0c919xjGpB8uOSrTJ5e6KPgZx+lVfYw=
dep	github.com/smallstep/certificates	v0.24.3-rc1	h1:mN6Hdymg7kfhjmAHAucTZAOXTaC24Rig1XXgBR+2n9M=
dep	github.com/smallstep/go-attestation	v0.4.4-0.20230509120429-e17291421738	h1:h+cZgVniTaE0uuRMdxTThLaJeuxsv4aas6oStz6f5VQ=
dep	github.com/smallstep/nosql	v0.6.0	h1:ur7ysI8s9st0cMXnTvB8tA3+x5Eifmkb6hl4uqNV5jc=
dep	github.com/smallstep/truststore	v0.12.1	h1:guLUKkc1UlsXeS3t6BuVMa4leOOpdiv02PCRTiy1WdY=
dep	github.com/spf13/cast	v1.5.1	h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA=
dep	github.com/spf13/cobra	v1.7.0	h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
dep	github.com/spf13/pflag	v1.0.5	h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
dep	github.com/stoewer/go-strcase	v1.3.0	h1:g0eASXYtp+yvN9fK8sH94oCIk0fau9uV1/ZdJ0AVEzs=
dep	github.com/tailscale/tscert	v0.0.0-20230509043813-4e9cb4f2b4ad	h1:JEOo9j4RzDPBJFTU9YZ/QPkLtfV8+6PbZFFOSUx5VP4=
dep	github.com/things-go/go-socks5	v0.0.3	h1:QtlIhkwDuLNCwW3wnt2uTjn1mQzpyjnwct2xdPuqroI=
dep	github.com/tidwall/btree	v1.6.0	h1:LDZfKfQIBHGHWSwckhXI0RPSXzlo+KYdjK7FWSqOzzg=
dep	github.com/tidwall/match	v1.1.1	h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
dep	github.com/tidwall/redcon	v1.6.2	h1:5qfvrrybgtO85jnhSravmkZyC0D+7WstbfCs3MmPhow=
dep	github.com/ueffel/caddy-brotli	v1.3.0	h1:c2EgDCrwb4B7BsiHKRMsXA+tXNihs/IG59qiQu/Ducw=
dep	github.com/urfave/cli	v1.22.14	h1:ebbhrRiGK2i4naQJr+1Xj92HXZCrK7MsyTS/ob3HnAk=
dep	github.com/vmihailenco/msgpack/v5	v5.3.5	h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU=
dep	github.com/vmihailenco/tagparser/v2	v2.0.0	h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g=
dep	github.com/x448/float16	v0.8.4	h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
dep	github.com/xujiajun/mmap-go	v1.0.1	h1:7Se7ss1fLPPRW+ePgqGpCkfGIZzJV6JPq9Wq9iv/WHc=
dep	github.com/xujiajun/nutsdb	v0.11.1	h1:zLyIvp3ABHMohtcqi0sbt7gGOFWfse+ZbLv2GVb6ZYw=
dep	github.com/xujiajun/utils	v0.0.0-20220904132955-5f7c5b914235	h1:w0si+uee0iAaCJO9q86T6yrhdadgcsoNuh47LrUykzg=
dep	github.com/yuin/goldmark	v1.5.5	h1:IJznPe8wOzfIKETmMkd06F8nXkmlhaHqFRM9l1hAGsU=
dep	github.com/yuin/goldmark-highlighting/v2	v2.0.0-20230729083705-37449abec8cc	h1:+IAOyRda+RLrxa1WC7umKOZRsGq4QrFFMYApOeHzQwQ=
dep	github.com/zeebo/blake3	v0.2.3	h1:TFoLXsjeXqRNFxSbk35Dk4YtszE/MQQGK10BH4ptoTg=
dep	go.etcd.io/bbolt	v1.3.7	h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ=
dep	go.etcd.io/etcd/api/v3	v3.5.7	h1:sbcmosSVesNrWOJ58ZQFitHMdncusIifYcrBfwrlJSY=
dep	go.etcd.io/etcd/client/pkg/v3	v3.5.7	h1:y3kf5Gbp4e4q7egZdn5T7W9TSHUvkClN6u+Rq9mEOmg=
dep	go.etcd.io/etcd/client/v3	v3.5.7	h1:u/OhpiuCgYY8awOHlhIhmGIGpxfBU/GZBUP3m/3/Iz4=
dep	go.mozilla.org/pkcs7	v0.0.0-20210826202110-33d05740a352	h1:CCriYyAfq1Br1aIYettdHZTy8mBTIPo7We18TuO/bak=
dep	go.opencensus.io	v0.24.0	h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0=
dep	go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp	v0.42.0	h1:pginetY7+onl4qN1vl0xW/V/v6OBZ0vVdH+esuJgvmM=
dep	go.opentelemetry.io/contrib/propagators/autoprop	v0.42.0	h1:s2RzYOAqHVgG23q8fPWYChobUoZM6rJZ98EnylJr66w=
dep	go.opentelemetry.io/contrib/propagators/aws	v1.17.0	h1:IX8d7l2uRw61BlmZBOTQFaK+y22j6vytMVTs9wFrO+c=
dep	go.opentelemetry.io/contrib/propagators/b3	v1.17.0	h1:ImOVvHnku8jijXqkwCSyYKRDt2YrnGXD4BbhcpfbfJo=
dep	go.opentelemetry.io/contrib/propagators/jaeger	v1.17.0	h1:Zbpbmwav32Ea5jSotpmkWEl3a6Xvd4tw/3xxGO1i05Y=
dep	go.opentelemetry.io/contrib/propagators/ot	v1.17.0	h1:ufo2Vsz8l76eI47jFjuVyjyB3Ae2DmfiCV/o6Vc8ii0=
dep	go.opentelemetry.io/otel	v1.16.0	h1:Z7GVAX/UkAXPKsy94IU+i6thsQS4nb7LviLpnaNeW8s=
dep	go.opentelemetry.io/otel/exporters/otlp/internal/retry	v1.16.0	h1:t4ZwRPU+emrcvM2e9DHd0Fsf0JTPVcbfa/BhTDF03d0=
dep	go.opentelemetry.io/otel/exporters/otlp/otlptrace	v1.16.0	h1:cbsD4cUcviQGXdw8+bo5x2wazq10SKz8hEbtCRPcU78=
dep	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc	v1.16.0	h1:TVQp/bboR4mhZSav+MdgXB8FaRho1RC8UwVn3T0vjVc=
dep	go.opentelemetry.io/otel/metric	v1.16.0	h1:RbrpwVG1Hfv85LgnZ7+txXioPDoh6EdbZHo26Q3hqOo=
dep	go.opentelemetry.io/otel/sdk	v1.16.0	h1:Z1Ok1YsijYL0CSJpHt4cS3wDDh7p572grzNrBMiMWgE=
dep	go.opentelemetry.io/otel/trace	v1.16.0	h1:8JRpaObFoW0pxuVPapkgH8UhHQj+bJW8jJsCZEu5MQs=
dep	go.opentelemetry.io/proto/otlp	v0.19.0	h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw=
dep	go.step.sm/cli-utils	v0.8.0	h1:b/Tc1/m3YuQq+u3ghTFP7Dz5zUekZj6GUmd5pCvkEXQ=
dep	go.step.sm/crypto	v0.33.0	h1:fP8awo6YkZ0/rrLhzbHYA3U8g24VnWEebZRnGwUobRo=
dep	go.step.sm/linkedca	v0.20.0	h1:bH41rvyDm3nSSJ5xgGsKUZOpzJcq5x2zacMIeqtq9oI=
dep	go.uber.org/multierr	v1.11.0	h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
dep	go.uber.org/zap	v1.25.0	h1:4Hvk6GtkucQ790dqmj7l1eEnRdKm3k3ZUrUMS2d5+5c=
dep	golang.org/x/crypto	v0.12.0	h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk=
dep	golang.org/x/exp	v0.0.0-20230801115018-d63ba01acd4b	h1:r+vk0EmXNmekl0S0BascoeeoHk/L7wmaW2QF90K+kYI=
dep	golang.org/x/net	v0.14.0	h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14=
dep	golang.org/x/sync	v0.3.0	h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
dep	golang.org/x/sys	v0.11.0	h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
dep	golang.org/x/term	v0.11.0	h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0=
dep	golang.org/x/text	v0.12.0	h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc=
dep	golang.org/x/time	v0.3.0	h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
dep	google.golang.org/genproto	v0.0.0-20230726155614-23370e0ffb3e	h1:xIXmWJ303kJCuogpj0bHq+dcjcZHU+XFyc1I0Yl9cRg=
dep	google.golang.org/genproto/googleapis/api	v0.0.0-20230731193218-e0aa005b6bdf	h1:xkVZ5FdZJF4U82Q/JS+DcZA83s/GRVL+QrFMlexk9Yo=
dep	google.golang.org/genproto/googleapis/rpc	v0.0.0-20230731193218-e0aa005b6bdf	h1:guOdSPaeFgN+jEJwTo1dQ71hdBm+yKSCCKuTRkJzcVo=
dep	google.golang.org/grpc	v1.57.0	h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw=
dep	google.golang.org/protobuf	v1.31.0	h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
dep	gopkg.in/natefinch/lumberjack.v2	v2.2.1	h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
dep	gopkg.in/square/go-jose.v2	v2.6.0	h1:NGk74WTnPKBNUhNzQX7PYcTLUjoq7mzKk2OKbvwk2iI=
dep	gopkg.in/yaml.v2	v2.4.0	h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
dep	gopkg.in/yaml.v3	v3.0.1	h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
build	-buildmode=exe
build	-compiler=gc
build	-trimpath=true
build	CGO_ENABLED=0
build	GOARCH=amd64
build	GOOS=linux
build	GOAMD64=v1

6. Please paste any relevant HTTP request(s) here.

{"level":"error","ts":1692210036.1514633,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"*.*.*.*","remote_port":"32362","client_ip":"*.*.*.*","proto":"HTTP/2.0","method":"CONNECT","host":"www.google.com:443","uri":"www.google.com:443","headers":{"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"example.com"}},"bytes_read":0,"user_id":"","duration":0.051599699,"size":0,"status":500,"resp_headers":{"Server":["Caddy"],"Alt-Svc":["h3=\":8443\"; ma=2592000"]}}

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:

{"level":"error","ts":1692210036.1514091,"logger":"http.log.error.log0","msg":"ResponseWriter doesn't implement http.Flusher","request":{"remote_ip":"*.*.*.*","remote_port":"32362","client_ip":"*.*.*.*","proto":"HTTP/2.0","method":"CONNECT","host":"www.google.com:443","uri":"www.google.com:443","headers":{"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"example.com"}},"duration":0.051599699,"status":500,"err_id":"a8v3vpdmf","err_trace":"forwardproxy.(*Handler).ServeHTTP (forwardproxy.go:314)"}

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.

@mholt
Copy link
Member

mholt commented Aug 17, 2023

Ah yeah, sorry about this. We didn't know this would be a breaking change, as Go recently introduced the http.ResponseController type. So instead of type-asserting, module code now needs to use ResponseController to flush, etc. (Should be an easy change at least. Again, sorry, this one surprised us.)

@jerry-wolf
Copy link
Author

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)
 		}

@klzgrad
Copy link
Contributor

klzgrad commented Feb 18, 2024

Should be fixed after #74.

@mholt
Copy link
Member

mholt commented Feb 21, 2024

@jerry-wolf Do you want to try again now with the latest commits?

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