
로컬에서 올바르게 작동하는 Docker 이미지로 빌드된 애플리케이션이 있지만 Google Cloud Run에서 '업스트림 연결 오류 또는 헤더 전에 연결 해제/재설정. 재설정 이유: 프로토콜 오류'와 함께 실패합니다.
애플리케이션은 0.0.0.0:8080에서 수신 대기 중이며 인증이 필요하지 않습니다. Docker에서 로컬로 실행하고 있습니다.
docker run --rm --name myapp -p 8080:8080 myapp:1.0
로컬에서 컬을 사용하면 /에서 성공적인 응답을 받습니다.
$ curl -v localhost:8080
* Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8080 (#0)
> GET / HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.64.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: application/json
< Vary: Origin
< Date: Sat, 24 Jul 2021 13:54:11 GMT
< Content-Length: 2
<
* Connection #0 to host localhost left intact
OK* Closing connection 0
이를 Google Cloud Run as a Service에 배포했으며, 첫 번째 요청을 할 때 Cloud Run 로그에 내 애플리케이션의 로그 출력이 표시되어 애플리케이션이 시작되었고 포트 8080에서 수신 대기 중임을 나타냅니다.
그러나 요청이 실패합니다.
"upstream connect error or disconnect/reset before headers. reset reason: protocol error"
컬 -v의 전체 출력https://cloudrun-srv-stuff.a.run.app/다음과 같다
* Trying 216.239.36.53...
* TCP_NODELAY set
* Connected to cloudrun-srv-lz5wvvl32a-ez.a.run.app (216.239.36.53) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/cert.pem
CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-ECDSA-CHACHA20-POLY1305
* ALPN, server accepted to use h2
* Server certificate:
* subject: C=US; ST=California; L=Mountain View; O=Google LLC; CN=*.a.run.app
* start date: Jun 28 01:08:46 2021 GMT
* expire date: Sep 20 01:08:45 2021 GMT
* subjectAltName: host "cloudrun-srv-stuff.a.run.app" matched cert's "*.a.run.app"
* issuer: C=US; O=Google Trust Services; CN=GTS CA 1O1
* SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x7f83b4810a00)
> GET / HTTP/2
> Host: cloudrun-srv-stuff.a.run.app
> User-Agent: curl/7.64.1
> Accept: */*
>
* Connection state changed (MAX_CONCURRENT_STREAMS == 100)!
< HTTP/2 502
< content-length: 87
< content-type: text/plain
< date: Sat, 24 Jul 2021 13:58:13 GMT
< server: Google Frontend
< x-cloud-trace-context: 1370fab1a02839b367048f855593cbef/5890123523738625787;o=1
< alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
<
이를 디버깅하는 다음 단계는 무엇입니까?
답변1
내 질문에 대한 John Hanely의 답변에서 문제가 확인되었습니다.https://cloud.google.com/run/docs/configuring/http2#consolehttp/2 엔드투엔드를 비활성화할 수 있게 되었고 이로 인해 문제가 해결되었습니다.