Closed sunszl closed 4 years ago
That should work. Move BaseUrl to GlobalConfiguration (read the docs). Also set log level to Trace and check logs from Ocelot.
{
"ReRoutes": [
{
"DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "https",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 44396
}
],
"ReRouteIsCaseSensitive": false,
"UpstreamPathTemplate": "/ruter/{everything}",
"UpstreamHttpMethod": [],
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "5s",
"PeriodTimespan": 5,
"Limit": 2,
"QuotaExceededMessage": "Customize Tips!"
}
}
],
"GlobalConfiguration": {
"BaseUrl": "https://localhost:44315"
}
}
this is full version of my ocelot.json. I tried many times, it works for 'https://localhost:44315/api'. But it doesn't works for 'https://localhost:44315/api/method'.
I just tested it and it works.
{
"DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "https",
"DownstreamHostAndPorts": [
{
"Host": "jsonplaceholder.typicode.com",
"Port": 443
}
],
"UpstreamPathTemplate": "/posts/{everything}",
"UpstreamHttpMethod": []
}
Running https://localhost:5001/posts/todos/3 Routes to https://jsonplaceholder.typicode.com/todos/3
I forgot to set the downstreamRoute. It has nothing to do with ocelot. Ignore this issuse. Anyway thanks for your help.
Expected Behavior / New Feature
I want to reroute upstream: /reroute/api/method to downStream: /api/method
Actual Behavior / Motivation for New Feature
It's Ok if there is only the api part. "/reroute/api" will be rerouted to "/api/" But if the method part is added. Ocelot failed to recognize this pattter. put "/reroute/api/method" in ,and it will not trigger the reroute role.
Steps to Reproduce the Problem