简体   繁体   English

无法调用 traefik 反向代理后托管的 grpc 服务器

[英]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.

相关问题 IIS 7反向代理背后的Websocket服务器 - Websocket Server Behind IIS 7 Reverse Proxy 自托管 GRPC 服务器 - Self hosted GRPC server 反向代理背后的 WebService - WebService behind reverse proxy 当我们在代理后面时,无法使用StreamSocket连接IMAP服务器 - Unable to connect IMAP server using StreamSocket when we are behind the Proxy How to set BaseUrl for Swagger in ASP.NET Core Web API using NSwag.AspNetCore (when hosted behind a reverse proxy) - How to set BaseUrl for Swagger in ASP.NET Core Web API using NSwag.AspNetCore (when hosted behind a reverse proxy) 在反向代理后面部署 IdentityServer4 - Deploying IdentityServer4 behind reverse proxy 如何启用 nginx 反向代理以与 gRPC in.Net core 一起使用? - How to enable nginx reverse proxy to work with gRPC in .Net core? 如何强制更新/防止在 Linux 上运行并由 nginx 反向代理服务器托管的 .NET Core Web 应用程序的 HTML 缓存 - How to force updates / prevent HTML caching of .NET Core web application running on Linux and hosted by an nginx reverse proxy server 无法连接到托管在 Docker 中的网络核心 gRPC 服务 - Unable to connect to net core gRPC service hosted in Docker 使用反向代理使用SSL(https)配置IIS托管的WCF服务 - Using reverse proxy to configure IIS hosted WCF services with SSL(https)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM