[英]Unable to call grpc server hosted behind traefik reverse proxy
I am facing a weird issue where I am unable to call gRPC server hosted behind traefik proxy running in a container with http/2 and a custom subdomain from asp.net 5 app also hosted in another container with another domain name mapped to it.我面临一个奇怪的问题,我无法调用托管在 traefik 代理后面的 gRPC 服务器,该服务器在具有 http/2 的容器中运行,并且来自 asp.net 5 应用程序的自定义子域也托管在另一个容器中,该容器映射了另一个域名。 I am getting the below error:我收到以下错误:
Status(StatusCode="Unavailable", Detail="Error starting gRPC call. HttpRequestException: Connection timed out (subdomain:443) SocketException: Connection timed out", DebugException="System.Net.Http.HttpRequestException: Connection timed out (subdomain:443)
When I try to call the same hosted gRPC server from development docker-compose, it just works fine.当我尝试从开发 docker-compose 调用相同的托管 gRPC 服务器时,它工作正常。 I have tried different compositions of Uri address (scheme, host and port), both method provided by Microsoft on their website to call gRPC server (console and DI) and I have even tried to set the below AppContext to true but it seems like the hosted app is just unable to start the call.我尝试了不同的 Uri 地址组合(方案、主机和端口),这两种方法都是 Microsoft 在其网站上提供的调用 gRPC 服务器(控制台和 DI)的方法,我什至尝试将以下 AppContext 设置为 true,但看起来像托管应用程序无法启动通话。
System.AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport");
The docker-compose of grpc server is: grpc服务器的docker-compose为:
version: '3'
networks:
web:
external: true
internal:
external: false
services:
grpcservice:
image: <imagename:tag>
labels:
- traefik.protocol=h2c
- traefik.backend=grpcservice
- traefik.frontend.rule=Host:<subdomain>
- traefik.docker.network=web
- traefik.port=9001
networks:
- internal
- web
environment:
- ASPNETCORE_ENVIRONMENT=Production
- FilePath__FPath=<some file>
- Auth0__Domain=<Domain>
- Auth0__Audience=<Audience>
restart: on-failure
The docker-compose of Asp.net 5 App is: Asp.net 5 App的docker-compose是:
version: '3'
networks:
web:
external: true
internal:
external: false
services:
aspapp:
image: <imagename:tag>
labels:
- traefik.backend=aspapp
- traefik.frontend.rule=Host:<domain>
- traefik.docker.network=web
- traefik.port=9000
networks:
- internal
- web
environment:
- ASPNETCORE_ENVIRONMENT=Production
<Auth0 envoirnment vairables>
restart: on-failure
Traefik.toml configs are: Traefik.toml 配置为:
defaultEntryPoints = ["http", "https"]
[entryPoints]
[entryPoints.dashboard]
address = ":8080"
[entryPoints.dashboard.auth]
[entryPoints.dashboard.auth.basic]
users = ["Auth credentials"]
[entryPoints.http]
address = ":80"
[entryPoints.http.redirect]
entryPoint = "https"
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
[api]
entrypoint="dashboard"
[acme]
email = "email"
storage = "acme.json"
entryPoint = "https"
onHostRule = true
[acme.httpChallenge]
entryPoint = "http"
logLevel = "DEBUG"
[traefikLog]
filePath = "traefik.log"
format = "json"
[docker]
domain = "domain"
watch = true
network = "web"
I am just unable to understand why there is a discrepancy in behaviour when I am accessing the same gRPC server from the hosted app and from local development container and how can I get around it?当我从托管应用程序和本地开发容器访问同一个 gRPC 服务器时,我无法理解为什么会出现行为差异,我该如何解决?
It was just a stupid firewall issue that was blocking container out @ 443这只是一个愚蠢的防火墙问题,阻止了容器 @ 443
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.