ThreeMammals/Ocelot

Dynamic Routing Error: Using dynamic routing with services that use HTTP and HTTPS

Open

#2,253 建立於 2025年1月18日

在 GitHub 查看
 (12 留言) (0 反應) (0 負責人)C# (8,137 star) (1,617 fork)batch import
ConsulRoutingService Discoveryhelp wantedmedium effortproposal

描述

Please I have a simple .Net 8 web api application where Ocelot version 23.2.2 is used and I have this configuration. I am also using CONSUL as service discovery. When running in a container with docker-compose and trying to use dynamic routing I want to use internal APIs with HTTP and external APIs with HTTPS so I configure OCELOT like this:

{
  "Routes": [],
  "DynamicRoutes": [
    {
      "ServiceName": "openloyalti",
      "UseServiceDiscovery": true
    }
  ],
  "GlobalConfiguration": {
    "ServiceDiscoveryProvider": {
      "RequestIdKey": "OcRequestId",
      "Scheme": "http",
      "Host": "consul-server",
      "Port": 8500,
      "Type": "Consul"
    },
    "RateLimitOptions": {
      "ClientWhitelist": [],
      "EnableRateLimiting": false,
      "HttpStatusCode": 429,
      "QuotaExceededMessage": "Too many requests, please try again later."
    },
    "LoadBalancerOptions": {
      "Type": "LeastConnection"
    },
    "HttpHandlerOptions": {
      "UseTracing": true
    },
    "DownstreamScheme": "http"
  }
}

When doing so I always get this exception:

Basically I want to know how to solve my problem of using dynamic routing with services that use HTTP and other services that use HTTPS.

貢獻者指南