0

所以我有一个 dapr 服务托管在:192.168.1.34:50459

我正在尝试让它使用 grpc-web 与我的 Web 应用程序通信。为此,我有一个特使代理(根据https://github.com/grpc/grpc-web/issues/347)。

我的 envoy.yaml 文件如下:

static_resources:
  listeners:
  - name: listener_0
    address:
      socket_address: { address: 0.0.0.0, port_value: 4949 }
    filter_chains:
    - filters:
      - name: envoy.http_connection_manager
        config:
          codec_type: auto
          stat_prefix: ingress_http
          route_config:
            name: local_route
            virtual_hosts:
            - name: local_service
              domains: ["*"]
              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: custom-header-1,grpc-status,grpc-message
          http_filters:
          - name: envoy.grpc_web
          - name: envoy.cors
          - name: envoy.router
  clusters:
  - name: greeter_service
    connect_timeout: 0.25s
    type: logical_dns
    http2_protocol_options: {}
    lb_policy: round_robin
    hosts: [{ socket_address: { address: 192.168.1.34, port_value: 50459 }}]

它应该在 0.0.0.0:4949 侦听,并将其转发到 192.168.1.34:50459

但是当我启动这个代理时

docker run -d -v envoy.yaml:/etc/envoy/envoy.yaml:ro -p 4949:4949 -p 50459:50459 envoyproxy/envoy:v1.15.0

它将它路由到 0.0.0.0:50459

在此处输入图像描述

有谁知道如何解决这个问题?

4

1 回答 1

0

我对特使了解不多,但是您可以将其配置为登录到挂载路径吗?看看是不是真的配置了路由?另外,我假设您正在设置--dapr-grpc-port explicitlyin Dapr 运行命令?您是否尝试过将其设置为差异端口以防发生碰撞?

于 2020-09-18T01:14:05.520 回答