{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/16788","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/16788/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/16788/comments","events_url":"https://api.github.com/repos/golang/go/issues/16788/events","html_url":"https://github.com/golang/go/issues/16788","id":171906891,"number":16788,"title":"net/http/httputil: Proxy terminates HTTP/2 stream before reading response body.","user":{"login":"elithrar","id":18544,"avatar_url":"https://avatars.githubusercontent.com/u/18544?v=3","gravatar_id":"","url":"https://api.github.com/users/elithrar","html_url":"https://github.com/elithrar","followers_url":"https://api.github.com/users/elithrar/followers","following_url":"https://api.github.com/users/elithrar/following{/other_user}","gists_url":"https://api.github.com/users/elithrar/gists{/gist_id}","starred_url":"https://api.github.com/users/elithrar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elithrar/subscriptions","organizations_url":"https://api.github.com/users/elithrar/orgs","repos_url":"https://api.github.com/users/elithrar/repos","events_url":"https://api.github.com/users/elithrar/events{/privacy}","received_events_url":"https://api.github.com/users/elithrar/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/golang/go/labels/WaitingForInfo","name":"WaitingForInfo","color":"ededed"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2016-08-18T13:55:13Z","updated_at":"2016-08-18T21:32:09Z","closed_at":null,"body":"Please answer these questions before submitting your issue. Thanks!\r\n\r\n**1. What version of Go are you using (`go version`)?**\r\n\r\n`go version go1.7 darwin/amd64`\r\n\r\n**2. What operating system and processor architecture are you using (`go env`)?**\r\n\r\n```\r\nGOHOSTARCH=\"amd64\"\r\nGOHOSTOS=\"darwin\"\r\n```\r\n\r\n**3. What did you do?**\r\n\r\n* Running a reverse proxy using https://golang.org/pkg/net/http/httputil/\r\n* Proxies HTTP on host:port to a target server defined by the `-proxy` flag.\r\n* Sending POST data through the proxy (the proxy manipulates CORS headers)\r\n\r\n**4. What did you expect to see?**\r\n\r\n* A HTTP 200 (or other successful status code).\r\n\r\n**5. What did you see instead?**\r\n\r\n* A HTTP 502 and a proxy error due to premature termination of the HTTP/2 stream.\r\n\r\n```\r\ngo run simple.go -proxy=https://repeater.getattest.io/post/data -port=8001\r\n```\r\n```\r\ncurl http://localhost:8001/post/data -d \"gophers=yes;\"\r\n```\r\n```\r\nts=\"2016/08/18 06:40:38\" msg=\"http: proxy error: stream error: stream ID 3; STREAM_CLOSED\"\r\nts=2016-08-18T06:40:38-07:00 status=502 method=POST uri=https://repeater.getattest.io/post/data duration=20.74786ms bytes=0 from=127.0.0.1:56479\r\n```\r\n\r\n* The proxy I'm running (single file): https://gist.github.com/elithrar/a47af11adb818571d364cc5797ce0fb6 - run it, then hit with the curl above. *Updated with simpler code*\r\n* The upstream, in this case, is nginx (CloudFlare; HTTP/2), fronting my test server (Go on Heroku HTTP/1.1).\r\n* Running `binaryname -proxy=https://post.workwithgo.com/post/data` (Caddy, HTTP/2, proxying the same origin application) and running the same curl does not cause the same error.\r\n* To be tested: *nginx mainline over HTTP/2*, which appears to be the last remaining variable.\r\n\r\nNote: Disabling HTTP/2 via a custom transport on the upstream leg avoids the issue (as you would expect, given the error). I have yet to test on another HTTP/2 origin (I'll spin up a raw Caddy instance shortly)."},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/240863768","html_url":"https://github.com/golang/go/issues/16788#issuecomment-240863768","issue_url":"https://api.github.com/repos/golang/go/issues/16788","id":240863768,"user":{"login":"elithrar","id":18544,"avatar_url":"https://avatars.githubusercontent.com/u/18544?v=3","gravatar_id":"","url":"https://api.github.com/users/elithrar","html_url":"https://github.com/elithrar","followers_url":"https://api.github.com/users/elithrar/followers","following_url":"https://api.github.com/users/elithrar/following{/other_user}","gists_url":"https://api.github.com/users/elithrar/gists{/gist_id}","starred_url":"https://api.github.com/users/elithrar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elithrar/subscriptions","organizations_url":"https://api.github.com/users/elithrar/orgs","repos_url":"https://api.github.com/users/elithrar/repos","events_url":"https://api.github.com/users/elithrar/events{/privacy}","received_events_url":"https://api.github.com/users/elithrar/received_events","type":"User","site_admin":false},"created_at":"2016-08-18T21:32:09Z","updated_at":"2016-08-18T21:32:09Z","body":"```\r\n2016/08/18 14:19:22 POST - https://post.workwithgo.com/post/data - 127.0.0.1:65531\r\n2016/08/18 14:19:22 http2: Transport encoding header \":authority\" = \"post.workwithgo.com\"\r\n2016/08/18 14:19:22 http2: Transport encoding header \":method\" = \"POST\"\r\n2016/08/18 14:19:22 http2: Transport encoding header \":path\" = \"/post/data\"\r\n2016/08/18 14:19:22 http2: Transport encoding header \":scheme\" = \"https\"\r\n2016/08/18 14:19:22 http2: Transport encoding header \"x-forwarded-for\" = \"127.0.0.1\"\r\n2016/08/18 14:19:22 http2: Transport encoding header \"user-agent\" = \"curl/7.50.1\"\r\n2016/08/18 14:19:22 http2: Transport encoding header \"accept\" = \"*/*\"\r\n2016/08/18 14:19:22 http2: Transport encoding header \"content-type\" = \"application/x-www-form-urlencoded\"\r\n2016/08/18 14:19:22 http2: Transport encoding header \"content-length\" = \"12\"\r\n2016/08/18 14:19:22 http2: Transport encoding header \"accept-encoding\" = \"gzip\"\r\n2016/08/18 14:19:22 http2: Framer 0xc4200fccc0: wrote HEADERS flags=END_HEADERS stream=13 len=10\r\n2016/08/18 14:19:22 http2: Framer 0xc4200fccc0: wrote DATA flags=END_STREAM stream=13 len=12 data=\"gophers=yes;\"\r\n2016/08/18 14:19:22 http2: Framer 0xc4200fccc0: wrote DATA flags=END_STREAM stream=13 len=0 data=\"\"\r\n2016/08/18 14:19:22 http2: Framer 0xc4200fccc0: read WINDOW_UPDATE len=4 (conn) incr=12\r\n2016/08/18 14:19:22 http2: Transport received WINDOW_UPDATE len=4 (conn) incr=12\r\n2016/08/18 14:19:22 http2: Framer 0xc4200fccc0: read RST_STREAM stream=13 len=4 ErrCode=STREAM_CLOSED\r\n2016/08/18 14:19:22 http2: Transport received RST_STREAM stream=13 len=4 ErrCode=STREAM_CLOSED\r\n2016/08/18 14:19:22 RoundTrip failure: stream error: stream ID 13; STREAM_CLOSED\r\n2016/08/18 14:19:22 http: proxy error: stream error: stream ID 13; STREAM_CLOSED\r\n```\r\n\r\nIt looks like the `RST_STREAM` (from the client) is where we're hung up here. There is a similar issue in https://github.com/golang/go/issues/16514 but not concrete (I see the issue regardless of upstream webserver).\r\n"}}
{"actor":{"display_login":"elithrar"}}