Envoy Proxy with Docker for grpc-web.使用 SSL 会导致浏览器ERR_CERT_C



我正在尝试配置我的特使代理,以允许使用 grpc 将请求从我的角度应用程序保存到我的应用程序服务器。我加载了一个 letsencrypt 证书,但请求失败,Chrome 在尝试连接时打印 ERR_CERT_COMMON_NAME_INVALID。我有一个 apache2 正在运行为我的 Web 应用程序服务。docker 上的特使代理和 Web 应用程序在同一台计算机上运行。

我的特使:

admin:
access_log_path: /tmp/admin_access.log
address:
socket_address: { address: 0.0.0.0, port_value: 9901 }
static_resources:
listeners:
- name: listener_0
address:
socket_address: { address: 0.0.0.0, port_value: 17887 }
filter_chains:
- filters:
- name: envoy.http_connection_manager
config:
codec_type: auto
stat_prefix: ingress_http
stream_idle_timeout: 0s
route_config:
name: local_route
virtual_hosts:
- name: local_service
domains: ["myactualdomain.com"]
routes:
- match: { prefix: "/" }
route:
cluster: greeter_service
max_grpc_timeout: 0s
cors:
allow_origin_string_match:
- prefix: "*"
allow_methods: GET, PUT, DELETE, POST, OPTIONS
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: "1728000"
expose_headers: grpc-status,grpc-message
http_filters:
- name: envoy.grpc_web
- name: envoy.cors
- name: envoy.router
tls_context:
common_tls_context:
alpn_protocols: "h2"
tls_certificates:
- certificate_chain: { filename: "/etc/fullchain.pem" }
private_key: { filename: "/etc/privkey.pem" }
clusters:
- name: greeter_service
connect_timeout: 1.00s
type: logical_dns
http2_protocol_options: {}
lb_policy: round_robin
hosts: [{ socket_address: { address: localhost, port_value: 17888 }}]

我想我可能是因为我没有使用传统的https端口。

任何帮助表示赞赏。

我实际上让它工作了。首先,我为 envoy 代理添加了一个新的子域,并创建了一对新的证书。也不要这样做:域:["myactualdomain.com"],而是["*"],因为这会导致违反CORS的行为。如果您只与 grpc-web 连接并且特使不使用 ssl,因为它们无论如何都在同一台机器上运行。如果你不想这样做,你可能想看看:https://medium.com/@farcaller/how-to-configure-https-backends-in-envoy-b446727b2eb3,我没有尝试过。

最新更新