esp: CORS not working with gRPC endpoints
I have a gRPC service exposed to the world via Google Cloud Endpoints/esp. I am able to access this service via a grpc-web NodeJS client without any issues. However, when trying to access the service via a browser JS app (using the same grpc-web client code), calls fail due to the OPTION calls (CORS) being rejected.
Here is my endpoints.yaml configuration file:
type: google.api.Service
config_version: 3
name: redacted.cloud.goog
title: My API
apis:
- name: my.namespace.api
endpoints:
- name: redacted.cloud.goog
allow_cors: true
usage:
rules:
- selector: "*"
allow_unregistered_calls: true
http:
rules:
# ...
Here’s the relevant part of my k8s deployment configuration:
- name: esp
image: gcr.io/endpoints-release/endpoints-runtime:1
args: [
"--http_port=8080",
"--http2_port=9090",
"--service=redacted.cloud.goog",
"--version=2017-12-08r1",
"--backend=grpc://127.0.0.1:5000"
]
ports:
- containerPort: 8080
- containerPort: 9090
And here’s what I see in the ESP logs:
{
error_cause: "service_control"
http_method: "OPTIONS"
http_response_code: 403
location: "us-east4-c"
log_message: "Endpoints management skipped for an unrecognized HTTP call: OPTIONS /redacted"
producer_project_id: "redacted"
referer: "http://localhost:4200/"
request_latency_in_ms: 1
request_size_in_bytes: 802
response_size_in_bytes: 401
timestamp: 1512750043.5942123
url: "/redacted"
}
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 3
- Comments: 30 (15 by maintainers)
Yes, it should be in 1.17.0 ESP release
We should have release this week with the change.