Ocelot: Administration API doesn't work

Expected Behavior

Overrwrites the existing configuration

Actual Behavior

Returns 500 Internal Server Error

InvalidOperationException: Error parsing discovery document from http://localhost:5000/administration/.well-known/openid-configuration: Error connecting to http://localhost:5000/administration/.well-known/openid-configuration: No connection could be made because the target machine actively refused it

Steps to Reproduce the Problem

  1. Read docs
  2. Download ocelot.postman_collection.json
  3. In Startup.cs add .AddAdministration("/administration", "secret");
  4. Run service with api gateway: dotnet run: Now listening on: http://localhost:55580
  5. Make POST to get token
POST /administration/connect/token HTTP/1.1
Host: localhost:55580
Cache-Control: no-cache
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW

------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="client_id"

admin
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="client_secret"

secret
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="scope"

admin
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="grant_type"

client_credentials
------WebKitFormBoundary7MA4YWxkTrZu0gW--
  1. Make POST request to overrwrite the existing configuration

POST /administration/configuration HTTP/1.1
Host: localhost:55580
Authorization: Bearer pZWysp2fn03YLZV_3vejLGvLNvoyuYz3WTXyWcslaMay6oE3i95p1SxwcQ9FcYH4hp-8fqJ_H10WslPLV9KwmyBw2SsI2DoOrb8r0OXr5VZO_-E_SD3SjKyuh3NU05JTLHge_VtZV...
Content-Type: application/json
Cache-Control: no-cache

{
	"ReRoutes": [
    {
      "ServiceName" : "templates",
      "DownstreamPathTemplate": "/{everything}",
      "DownstreamScheme": "http",
      "DownstreamHostAndPorts": [
        {
          "Host": "localhost",
          "Port": 50689
        }
      ],
      "UpstreamPathTemplate": "/templates/{everything}",
      "UpstreamHttpMethod": [ "GET" ]
    }
  ],
  "GlobalConfiguration": {
    "RequestIdKey": "Request-Id"
  }
}

Returns 500 Internal Server Error

InvalidOperationException: Error parsing discovery document from http://localhost:5000/administration/.well-known/openid-configuration: Error connecting to http://localhost:5000/administration/.well-known/openid-configuration: No connection could be made because the target machine actively refused it

  1. Make POST request to http://localhost:55580/administration/.well-known/openid-configuration
GET /administration/.well-known/openid-configuration HTTP/1.1
Host: localhost:55580
Authorization: Bearer pZWysp2fn03YLZV_3vejLGvLNvoyuYz3WTXyWcslaMay6oE3i95p1SxwcQ9FcYH4hp-8fqJ_H10WslPLV9KwmyBw2SsI2DoOrb8r0OXr5VZO_-E_SD3SjKyuh3NU05JTLHge_VtZV...
Cache-Control: no-cache

Returns

InvalidOperationException: Policy error while contacting the discovery endpoint http://localhost:5000/administration/.well-known/openid-configuration: Issuer name does not match authority: Ocelot

Specifications

  • Version: 8.0.0
  • Platform: Windows 10
  • Subsystem: netcoreapp2.1

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 28 (17 by maintainers)

Commits related to this issue

Most upvoted comments

@Marusyk thanks I will check this out ASAP.

@Marusyk I am sorry but I do not know what the problem is. I have tried the code I uploaded on mac, windows (dotnet cli and in visual studio) without any problems 😦

The only thing I can possibly think is that for some reason Ocelot cannot loopback to itself but seems unlikely.

ApiGatewayOcelot.zip

This works fine for me!