ThreeMammals / Ocelot

.NET API Gateway
https://www.nuget.org/packages/Ocelot
MIT License
8.35k stars 1.63k forks source link

Automatic Host Detect #774

Closed kKen94 closed 9 months ago

kKen94 commented 5 years ago

Is it possible to have something like this?

{
  "ReRoutes": [
    {
      "DownstreamPathTemplate": "/api/catalog/{everything}",
      "DownstreamScheme": "https",
      "DownstreamHostAndPorts": [
        {
          "Host": "/",
          "Port": 443
        }
      ],
      "UpstreamPathTemplate": "/catalog/{everything}",
      "UpstreamHttpMethod": [ "POST", "PUT", "GET", "DELETE" ],
      "AuthenticationOptions": {
        "AuthenticationProviderKey": "scheme",
        "AllowedScopes": []
      }
    },
    {
      "DownstreamPathTemplate": "/api/user/{everything}",
      "DownstreamScheme": "https",
      "DownstreamHostAndPorts": [
        {
          "Host": "/",
          "Port": 443
        }
      ],
      "UpstreamPathTemplate": "/user/{everything}",
      "UpstreamHttpMethod": [ "POST", "PUT", "GET", "DELETE" ]
    }
  ],
  "GlobalConfiguration": {
    "BaseUrl": "/"
  }
}

I have a microservices application and i have to install this application on my customers' servers. On IIS microservices are application under an unique site. I would like that in downstreamhostandport the gateway recognize automatically the host, to avoid specifying the host name for each customer

raman-m commented 9 months ago

Use Service Discovery and Consul! That's how you can abstract from hosts & ports.