envoy: gRPC-Web requests on Safari fail when using Envoy 1.13

When attempting to use gRPC-Web on Safari using Envoy 1.13, the request succeeds, but in the inspector in Safari, this is the error I see:

Failed to load resource: WebKit encountered an internal error

Here’s the web inspector output from Safari:

Summary

URL: https://myurl.io/svc.Authentication/Login
Status: —
Source: —
Initiator: 
2.c85f5bc6.chunk.js:2:583533

Request

Content-Type: application/grpc-web-text
Accept: application/grpc-web-text
Origin: https://my-url.com
Referer: https://my-url.com/login
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.5 Safari/605.1.15
X-User-Agent: grpc-web-javascript/0.1
X-Grpc-Web: 1
grpc-timeout: 4999m

Response

No response headers

Request Data

MIME Type: application/grpc-web-text
Request Data: 

This issue was initially raised under the https://github.com/grpc/grpc-web repo: https://github.com/grpc/grpc-web/issues/759

The request should return a successful response.

To give you more context, I’m personally running envoy via https://github.com/projectcontour/contour, though I don’t think it’s specific to contour since @phlippieb seems to be experiencing the same issue without contour I think.

I’m running envoy on GKE 1.15.9 as an ingress via a LoadBalancer (hence why I’m using contour).

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 10
  • Comments: 27 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Seems like skipping trailers.clear() for HTTP/2 could help this. @yoitsro could you try my image: dio123/envoy:grpc-web-debug (note that this one is ubuntu-based, not the alpine one)? From my local testing here, it seems to be working (I could reproduce this issue using the latest release).

Basically, the following:

  if (encoder_callbacks_->streamInfo().protocol().value() != Http::Protocol::Http2) {
    // Clear out the trailers so they don't get added since it is now in the body
    trailers.clear();
  }

@yoitsro sorry for the late reply, but I have submitted a PR: https://github.com/envoyproxy/envoy/pull/12178.

I set the parameters: alpn_protocols: - "http/1.1" - "h2" And everything worked

Someone responded on WebKit bugzilla that the problem is not inside WebKit but on a lower level library & now tracked Apple side in Radar as rdar://problem/61383605 (If anyone wants to reference it with them)