Closed profcoconut closed 8 months ago
This is a CORS issue. This enovy config works for me:
# Admin settings
admin:
access_log_path: /tmp/admin_access.log
address:
socket_address:
address: 0.0.0.0
port_value: 9901
# Static resource configurations
static_resources:
listeners:
- name: listener_0
address:
socket_address:
address: 0.0.0.0
port_value: 8080
filter_chains:
- filters:
- name: envoy.filters.network.http_connection_manager
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
codec_type: auto
stat_prefix: ingress_http
route_config:
name: local_route
virtual_hosts:
- name: local_service
domains: ["*"]
cors:
allow_origin_string_match:
- safe_regex:
google_re2: {}
regex: '^https?://localhost:[0-9]{4,5}$'
allow_headers: "keep-alive,user-agent,cache-control,content-type,content-transfer-encoding,custom-header-1,x-accept-content-transfer-encoding,x-accept-response-streaming,x-user-agent,x-grpc-web,grpc-timeout"
max_age: "1d"
routes:
- match:
prefix: "/"
route:
cluster: sample_cluster
timeout:
seconds: 60
# HTTP filter settings
http_filters:
# gRPC-Web filter
- name: envoy.filters.http.grpc_web
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.grpc_web.v3.GrpcWeb
# CORS filter
- name: envoy.filters.http.cors
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.cors.v3.Cors
# HTTP router filter
- name: envoy.filters.http.router
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
# Cluster settings
clusters:
- name: sample_cluster
connect_timeout: 0.25s
type: logical_dns
http2_protocol_options: {}
load_assignment:
cluster_name: sample_cluster
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: localhost # Change to your gRPC server address
port_value: 50051 # Change to your gRPC server port