mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 20:10:50 +08:00 
			
		
		
		
	mapped admin path works for manual test
This commit is contained in:
		
							
								
								
									
										13
									
								
								src/Ocelot/Controllers/ReRoutesController.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								src/Ocelot/Controllers/ReRoutesController.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
				
			|||||||
 | 
					using Microsoft.AspNetCore.Mvc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Ocelot.Controllers
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    [RouteAttribute("reroutes")]
 | 
				
			||||||
 | 
					    public class ReRoutesController
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        public IActionResult Get()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return new OkObjectResult("hi from re routes controller");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -31,7 +31,16 @@ namespace Ocelot.Middleware
 | 
				
			|||||||
        public static IApplicationBuilder UseOcelot(this IApplicationBuilder builder)
 | 
					        public static IApplicationBuilder UseOcelot(this IApplicationBuilder builder)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            CreateConfiguration(builder);
 | 
					            CreateConfiguration(builder);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            builder.Map("/admin", x => 
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					               x.UseMvc();
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            builder.UseOcelot(new OcelotMiddlewareConfiguration());
 | 
					            builder.UseOcelot(new OcelotMiddlewareConfiguration());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return builder;
 | 
					            return builder;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,7 +5,7 @@
 | 
				
			|||||||
      "DownstreamScheme": "http",
 | 
					      "DownstreamScheme": "http",
 | 
				
			||||||
      "DownstreamHost": "localhost",
 | 
					      "DownstreamHost": "localhost",
 | 
				
			||||||
      "DownstreamPort": 52876,
 | 
					      "DownstreamPort": 52876,
 | 
				
			||||||
      "UpstreamTemplate": "/identityserverexample",
 | 
					      "UpstreamPathTemplate": "/identityserverexample",
 | 
				
			||||||
      "UpstreamHttpMethod": "Get",
 | 
					      "UpstreamHttpMethod": "Get",
 | 
				
			||||||
      "QoSOptions": {
 | 
					      "QoSOptions": {
 | 
				
			||||||
        "ExceptionsAllowedBeforeBreaking": 3,
 | 
					        "ExceptionsAllowedBeforeBreaking": 3,
 | 
				
			||||||
@@ -50,7 +50,7 @@
 | 
				
			|||||||
      "DownstreamScheme": "http",
 | 
					      "DownstreamScheme": "http",
 | 
				
			||||||
      "DownstreamHost": "jsonplaceholder.typicode.com",
 | 
					      "DownstreamHost": "jsonplaceholder.typicode.com",
 | 
				
			||||||
      "DownstreamPort": 80,
 | 
					      "DownstreamPort": 80,
 | 
				
			||||||
      "UpstreamTemplate": "/posts",
 | 
					      "UpstreamPathTemplate": "/posts",
 | 
				
			||||||
      "UpstreamHttpMethod": "Get",
 | 
					      "UpstreamHttpMethod": "Get",
 | 
				
			||||||
      "QoSOptions": {
 | 
					      "QoSOptions": {
 | 
				
			||||||
        "ExceptionsAllowedBeforeBreaking": 3,
 | 
					        "ExceptionsAllowedBeforeBreaking": 3,
 | 
				
			||||||
@@ -63,7 +63,7 @@
 | 
				
			|||||||
      "DownstreamScheme": "http",
 | 
					      "DownstreamScheme": "http",
 | 
				
			||||||
      "DownstreamHost": "jsonplaceholder.typicode.com",
 | 
					      "DownstreamHost": "jsonplaceholder.typicode.com",
 | 
				
			||||||
      "DownstreamPort": 80,
 | 
					      "DownstreamPort": 80,
 | 
				
			||||||
      "UpstreamTemplate": "/posts/{postId}",
 | 
					      "UpstreamPathTemplate": "/posts/{postId}",
 | 
				
			||||||
      "UpstreamHttpMethod": "Get",
 | 
					      "UpstreamHttpMethod": "Get",
 | 
				
			||||||
      "QoSOptions": {
 | 
					      "QoSOptions": {
 | 
				
			||||||
        "ExceptionsAllowedBeforeBreaking": 3,
 | 
					        "ExceptionsAllowedBeforeBreaking": 3,
 | 
				
			||||||
@@ -76,7 +76,7 @@
 | 
				
			|||||||
      "DownstreamScheme": "http",
 | 
					      "DownstreamScheme": "http",
 | 
				
			||||||
      "DownstreamHost": "jsonplaceholder.typicode.com",
 | 
					      "DownstreamHost": "jsonplaceholder.typicode.com",
 | 
				
			||||||
      "DownstreamPort": 80,
 | 
					      "DownstreamPort": 80,
 | 
				
			||||||
      "UpstreamTemplate": "/posts/{postId}/comments",
 | 
					      "UpstreamPathTemplate": "/posts/{postId}/comments",
 | 
				
			||||||
      "UpstreamHttpMethod": "Get",
 | 
					      "UpstreamHttpMethod": "Get",
 | 
				
			||||||
      "QoSOptions": {
 | 
					      "QoSOptions": {
 | 
				
			||||||
        "ExceptionsAllowedBeforeBreaking": 3,
 | 
					        "ExceptionsAllowedBeforeBreaking": 3,
 | 
				
			||||||
@@ -89,7 +89,7 @@
 | 
				
			|||||||
      "DownstreamScheme": "http",
 | 
					      "DownstreamScheme": "http",
 | 
				
			||||||
      "DownstreamHost": "jsonplaceholder.typicode.com",
 | 
					      "DownstreamHost": "jsonplaceholder.typicode.com",
 | 
				
			||||||
      "DownstreamPort": 80,
 | 
					      "DownstreamPort": 80,
 | 
				
			||||||
      "UpstreamTemplate": "/comments",
 | 
					      "UpstreamPathTemplate": "/comments",
 | 
				
			||||||
      "UpstreamHttpMethod": "Get",
 | 
					      "UpstreamHttpMethod": "Get",
 | 
				
			||||||
      "QoSOptions": {
 | 
					      "QoSOptions": {
 | 
				
			||||||
        "ExceptionsAllowedBeforeBreaking": 3,
 | 
					        "ExceptionsAllowedBeforeBreaking": 3,
 | 
				
			||||||
@@ -102,7 +102,7 @@
 | 
				
			|||||||
      "DownstreamScheme": "http",
 | 
					      "DownstreamScheme": "http",
 | 
				
			||||||
      "DownstreamHost": "jsonplaceholder.typicode.com",
 | 
					      "DownstreamHost": "jsonplaceholder.typicode.com",
 | 
				
			||||||
      "DownstreamPort": 80,
 | 
					      "DownstreamPort": 80,
 | 
				
			||||||
      "UpstreamTemplate": "/posts",
 | 
					      "UpstreamPathTemplate": "/posts",
 | 
				
			||||||
      "UpstreamHttpMethod": "Post",
 | 
					      "UpstreamHttpMethod": "Post",
 | 
				
			||||||
      "QoSOptions": {
 | 
					      "QoSOptions": {
 | 
				
			||||||
        "ExceptionsAllowedBeforeBreaking": 3,
 | 
					        "ExceptionsAllowedBeforeBreaking": 3,
 | 
				
			||||||
@@ -115,7 +115,7 @@
 | 
				
			|||||||
      "DownstreamScheme": "http",
 | 
					      "DownstreamScheme": "http",
 | 
				
			||||||
      "DownstreamHost": "jsonplaceholder.typicode.com",
 | 
					      "DownstreamHost": "jsonplaceholder.typicode.com",
 | 
				
			||||||
      "DownstreamPort": 80,
 | 
					      "DownstreamPort": 80,
 | 
				
			||||||
      "UpstreamTemplate": "/posts/{postId}",
 | 
					      "UpstreamPathTemplate": "/posts/{postId}",
 | 
				
			||||||
      "UpstreamHttpMethod": "Put",
 | 
					      "UpstreamHttpMethod": "Put",
 | 
				
			||||||
      "QoSOptions": {
 | 
					      "QoSOptions": {
 | 
				
			||||||
        "ExceptionsAllowedBeforeBreaking": 3,
 | 
					        "ExceptionsAllowedBeforeBreaking": 3,
 | 
				
			||||||
@@ -128,7 +128,7 @@
 | 
				
			|||||||
      "DownstreamScheme": "http",
 | 
					      "DownstreamScheme": "http",
 | 
				
			||||||
      "DownstreamHost": "jsonplaceholder.typicode.com",
 | 
					      "DownstreamHost": "jsonplaceholder.typicode.com",
 | 
				
			||||||
      "DownstreamPort": 80,
 | 
					      "DownstreamPort": 80,
 | 
				
			||||||
      "UpstreamTemplate": "/posts/{postId}",
 | 
					      "UpstreamPathTemplate": "/posts/{postId}",
 | 
				
			||||||
      "UpstreamHttpMethod": "Patch",
 | 
					      "UpstreamHttpMethod": "Patch",
 | 
				
			||||||
      "QoSOptions": {
 | 
					      "QoSOptions": {
 | 
				
			||||||
        "ExceptionsAllowedBeforeBreaking": 3,
 | 
					        "ExceptionsAllowedBeforeBreaking": 3,
 | 
				
			||||||
@@ -141,7 +141,7 @@
 | 
				
			|||||||
      "DownstreamScheme": "http",
 | 
					      "DownstreamScheme": "http",
 | 
				
			||||||
      "DownstreamHost": "jsonplaceholder.typicode.com",
 | 
					      "DownstreamHost": "jsonplaceholder.typicode.com",
 | 
				
			||||||
      "DownstreamPort": 80,
 | 
					      "DownstreamPort": 80,
 | 
				
			||||||
      "UpstreamTemplate": "/posts/{postId}",
 | 
					      "UpstreamPathTemplate": "/posts/{postId}",
 | 
				
			||||||
      "UpstreamHttpMethod": "Delete",
 | 
					      "UpstreamHttpMethod": "Delete",
 | 
				
			||||||
      "QoSOptions": {
 | 
					      "QoSOptions": {
 | 
				
			||||||
        "ExceptionsAllowedBeforeBreaking": 3,
 | 
					        "ExceptionsAllowedBeforeBreaking": 3,
 | 
				
			||||||
@@ -154,7 +154,7 @@
 | 
				
			|||||||
      "DownstreamScheme": "http",
 | 
					      "DownstreamScheme": "http",
 | 
				
			||||||
      "DownstreamHost": "jsonplaceholder.typicode.com",
 | 
					      "DownstreamHost": "jsonplaceholder.typicode.com",
 | 
				
			||||||
      "DownstreamPort": 80,
 | 
					      "DownstreamPort": 80,
 | 
				
			||||||
      "UpstreamTemplate": "/products",
 | 
					      "UpstreamPathTemplate": "/products",
 | 
				
			||||||
      "UpstreamHttpMethod": "Get",
 | 
					      "UpstreamHttpMethod": "Get",
 | 
				
			||||||
      "QoSOptions": {
 | 
					      "QoSOptions": {
 | 
				
			||||||
        "ExceptionsAllowedBeforeBreaking": 3,
 | 
					        "ExceptionsAllowedBeforeBreaking": 3,
 | 
				
			||||||
@@ -168,7 +168,7 @@
 | 
				
			|||||||
      "DownstreamScheme": "http",
 | 
					      "DownstreamScheme": "http",
 | 
				
			||||||
      "DownstreamHost": "jsonplaceholder.typicode.com",
 | 
					      "DownstreamHost": "jsonplaceholder.typicode.com",
 | 
				
			||||||
      "DownstreamPort": 80,
 | 
					      "DownstreamPort": 80,
 | 
				
			||||||
      "UpstreamTemplate": "/products/{productId}",
 | 
					      "UpstreamPathTemplate": "/products/{productId}",
 | 
				
			||||||
      "UpstreamHttpMethod": "Get",
 | 
					      "UpstreamHttpMethod": "Get",
 | 
				
			||||||
      "FileCacheOptions": { "TtlSeconds": 15 }
 | 
					      "FileCacheOptions": { "TtlSeconds": 15 }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
@@ -177,7 +177,7 @@
 | 
				
			|||||||
      "DownstreamScheme": "http",
 | 
					      "DownstreamScheme": "http",
 | 
				
			||||||
      "DownstreamHost": "products20161126090340.azurewebsites.net",
 | 
					      "DownstreamHost": "products20161126090340.azurewebsites.net",
 | 
				
			||||||
      "DownstreamPort": 80,
 | 
					      "DownstreamPort": 80,
 | 
				
			||||||
      "UpstreamTemplate": "/products",
 | 
					      "UpstreamPathTemplate": "/products",
 | 
				
			||||||
      "UpstreamHttpMethod": "Post",
 | 
					      "UpstreamHttpMethod": "Post",
 | 
				
			||||||
      "QoSOptions": {
 | 
					      "QoSOptions": {
 | 
				
			||||||
        "ExceptionsAllowedBeforeBreaking": 3,
 | 
					        "ExceptionsAllowedBeforeBreaking": 3,
 | 
				
			||||||
@@ -190,7 +190,7 @@
 | 
				
			|||||||
      "DownstreamScheme": "http",
 | 
					      "DownstreamScheme": "http",
 | 
				
			||||||
      "DownstreamHost": "products20161126090340.azurewebsites.net",
 | 
					      "DownstreamHost": "products20161126090340.azurewebsites.net",
 | 
				
			||||||
      "DownstreamPort": 80,
 | 
					      "DownstreamPort": 80,
 | 
				
			||||||
      "UpstreamTemplate": "/products/{productId}",
 | 
					      "UpstreamPathTemplate": "/products/{productId}",
 | 
				
			||||||
      "UpstreamHttpMethod": "Put",
 | 
					      "UpstreamHttpMethod": "Put",
 | 
				
			||||||
      "QoSOptions": {
 | 
					      "QoSOptions": {
 | 
				
			||||||
        "ExceptionsAllowedBeforeBreaking": 3,
 | 
					        "ExceptionsAllowedBeforeBreaking": 3,
 | 
				
			||||||
@@ -204,7 +204,7 @@
 | 
				
			|||||||
      "DownstreamScheme": "http",
 | 
					      "DownstreamScheme": "http",
 | 
				
			||||||
      "DownstreamHost": "products20161126090340.azurewebsites.net",
 | 
					      "DownstreamHost": "products20161126090340.azurewebsites.net",
 | 
				
			||||||
      "DownstreamPort": 80,
 | 
					      "DownstreamPort": 80,
 | 
				
			||||||
      "UpstreamTemplate": "/products/{productId}",
 | 
					      "UpstreamPathTemplate": "/products/{productId}",
 | 
				
			||||||
      "UpstreamHttpMethod": "Delete",
 | 
					      "UpstreamHttpMethod": "Delete",
 | 
				
			||||||
      "QoSOptions": {
 | 
					      "QoSOptions": {
 | 
				
			||||||
        "ExceptionsAllowedBeforeBreaking": 3,
 | 
					        "ExceptionsAllowedBeforeBreaking": 3,
 | 
				
			||||||
@@ -218,7 +218,7 @@
 | 
				
			|||||||
      "DownstreamScheme": "http",
 | 
					      "DownstreamScheme": "http",
 | 
				
			||||||
      "DownstreamHost": "customers20161126090811.azurewebsites.net",
 | 
					      "DownstreamHost": "customers20161126090811.azurewebsites.net",
 | 
				
			||||||
      "DownstreamPort": 80,
 | 
					      "DownstreamPort": 80,
 | 
				
			||||||
      "UpstreamTemplate": "/customers",
 | 
					      "UpstreamPathTemplate": "/customers",
 | 
				
			||||||
      "UpstreamHttpMethod": "Get",
 | 
					      "UpstreamHttpMethod": "Get",
 | 
				
			||||||
      "QoSOptions": {
 | 
					      "QoSOptions": {
 | 
				
			||||||
        "ExceptionsAllowedBeforeBreaking": 3,
 | 
					        "ExceptionsAllowedBeforeBreaking": 3,
 | 
				
			||||||
@@ -232,7 +232,7 @@
 | 
				
			|||||||
      "DownstreamScheme": "http",
 | 
					      "DownstreamScheme": "http",
 | 
				
			||||||
      "DownstreamHost": "customers20161126090811.azurewebsites.net",
 | 
					      "DownstreamHost": "customers20161126090811.azurewebsites.net",
 | 
				
			||||||
      "DownstreamPort": 80,
 | 
					      "DownstreamPort": 80,
 | 
				
			||||||
      "UpstreamTemplate": "/customers/{customerId}",
 | 
					      "UpstreamPathTemplate": "/customers/{customerId}",
 | 
				
			||||||
      "UpstreamHttpMethod": "Get",
 | 
					      "UpstreamHttpMethod": "Get",
 | 
				
			||||||
      "QoSOptions": {
 | 
					      "QoSOptions": {
 | 
				
			||||||
        "ExceptionsAllowedBeforeBreaking": 3,
 | 
					        "ExceptionsAllowedBeforeBreaking": 3,
 | 
				
			||||||
@@ -246,7 +246,7 @@
 | 
				
			|||||||
      "DownstreamScheme": "http",
 | 
					      "DownstreamScheme": "http",
 | 
				
			||||||
      "DownstreamHost": "customers20161126090811.azurewebsites.net",
 | 
					      "DownstreamHost": "customers20161126090811.azurewebsites.net",
 | 
				
			||||||
      "DownstreamPort": 80,
 | 
					      "DownstreamPort": 80,
 | 
				
			||||||
      "UpstreamTemplate": "/customers",
 | 
					      "UpstreamPathTemplate": "/customers",
 | 
				
			||||||
      "UpstreamHttpMethod": "Post",
 | 
					      "UpstreamHttpMethod": "Post",
 | 
				
			||||||
      "QoSOptions": {
 | 
					      "QoSOptions": {
 | 
				
			||||||
        "ExceptionsAllowedBeforeBreaking": 3,
 | 
					        "ExceptionsAllowedBeforeBreaking": 3,
 | 
				
			||||||
@@ -260,7 +260,7 @@
 | 
				
			|||||||
      "DownstreamScheme": "http",
 | 
					      "DownstreamScheme": "http",
 | 
				
			||||||
      "DownstreamHost": "customers20161126090811.azurewebsites.net",
 | 
					      "DownstreamHost": "customers20161126090811.azurewebsites.net",
 | 
				
			||||||
      "DownstreamPort": 80,
 | 
					      "DownstreamPort": 80,
 | 
				
			||||||
      "UpstreamTemplate": "/customers/{customerId}",
 | 
					      "UpstreamPathTemplate": "/customers/{customerId}",
 | 
				
			||||||
      "UpstreamHttpMethod": "Put",
 | 
					      "UpstreamHttpMethod": "Put",
 | 
				
			||||||
      "QoSOptions": {
 | 
					      "QoSOptions": {
 | 
				
			||||||
        "ExceptionsAllowedBeforeBreaking": 3,
 | 
					        "ExceptionsAllowedBeforeBreaking": 3,
 | 
				
			||||||
@@ -274,7 +274,7 @@
 | 
				
			|||||||
      "DownstreamScheme": "http",
 | 
					      "DownstreamScheme": "http",
 | 
				
			||||||
      "DownstreamHost": "customers20161126090811.azurewebsites.net",
 | 
					      "DownstreamHost": "customers20161126090811.azurewebsites.net",
 | 
				
			||||||
      "DownstreamPort": 80,
 | 
					      "DownstreamPort": 80,
 | 
				
			||||||
      "UpstreamTemplate": "/customers/{customerId}",
 | 
					      "UpstreamPathTemplate": "/customers/{customerId}",
 | 
				
			||||||
      "UpstreamHttpMethod": "Delete",
 | 
					      "UpstreamHttpMethod": "Delete",
 | 
				
			||||||
      "QoSOptions": {
 | 
					      "QoSOptions": {
 | 
				
			||||||
        "ExceptionsAllowedBeforeBreaking": 3,
 | 
					        "ExceptionsAllowedBeforeBreaking": 3,
 | 
				
			||||||
@@ -288,7 +288,7 @@
 | 
				
			|||||||
      "DownstreamScheme": "http",
 | 
					      "DownstreamScheme": "http",
 | 
				
			||||||
      "DownstreamHost": "jsonplaceholder.typicode.com",
 | 
					      "DownstreamHost": "jsonplaceholder.typicode.com",
 | 
				
			||||||
      "DownstreamPort": 80,
 | 
					      "DownstreamPort": 80,
 | 
				
			||||||
      "UpstreamTemplate": "/posts/",
 | 
					      "UpstreamPathTemplate": "/posts/",
 | 
				
			||||||
      "UpstreamHttpMethod": "Get",
 | 
					      "UpstreamHttpMethod": "Get",
 | 
				
			||||||
      "QoSOptions": {
 | 
					      "QoSOptions": {
 | 
				
			||||||
        "ExceptionsAllowedBeforeBreaking": 3,
 | 
					        "ExceptionsAllowedBeforeBreaking": 3,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,7 +12,9 @@
 | 
				
			|||||||
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
 | 
					    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
 | 
				
			||||||
    "Ocelot": "0.0.0-dev",
 | 
					    "Ocelot": "0.0.0-dev",
 | 
				
			||||||
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
 | 
					    "Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
 | 
				
			||||||
    "Microsoft.NETCore.App": "1.1.0"
 | 
					    "Microsoft.NETCore.App": "1.1.0",
 | 
				
			||||||
 | 
					    "Consul": "0.7.2.1",
 | 
				
			||||||
 | 
					    "Polly": "5.0.3"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  "tools": {
 | 
					  "tools": {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user