Comments (8)
I delete "UpstreamHost":"localhost:6001" and it worked.
I want to use "UpstreamHost"
from ocelot.
Dear @raman-m
I created a sample project for you.
My ocelot.json
{
"Routes": [
{
"UpstreamHost": "localhost:6001",
"UpstreamPathTemplate": "/test/{everything}",
"DownstreamPathTemplate": "/{everything}",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 7071
}
]
},
{
"UpstreamHost": "localhost:6002",
"UpstreamPathTemplate": "/test/{everything}",
"DownstreamPathTemplate": "/{everything}",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 7072
}
]
}
],
"GlobalConfiguration": {
"BaseUrl": "https://localhost:6001"
}
}
Projects started
Ocelot18.Api(version 18.0.0) => https://localhost:6001;
=> https://localhost:6002,
Test1.Api => https://localhost:7071,
Test2.Api => https://localhost:7072
https://localhost:6001/test/WeatherForecast route matched
https://localhost:6002/test/WeatherForecast route matched
Projects stop
Projects started
Ocelot22.Api (version 22.0.1) => https://localhost:6001;
=> https://localhost:6002,
Test1.Api => https://localhost:7071,
Test2.Api => https://localhost:7072
https://localhost:6001/test/WeatherForecast route not found
https://localhost:6002/test/WeatherForecast route not found
Projects stop
Repository link: https://github.com/nrllhylmz/Example
Thanks.
from ocelot.
UpstreamHost not working
Why do you think so? Our unit & acceptance tests are green! 😉
I upgraded ocelot. (18.0.0 -> 22.0.1)
Maybe something wrong with the upgrade process...
Ocelot failed to match routes.
Wow! Please provide more details: ocelot.json file, logs with errors info, and etc.
Which routes? We don't see them! 😉
I deleted this feature. Routes matched. But i want to seperate host(UpstreamHost).
Sorry? What have you deleted and how?
from ocelot.
@nrllhylmz What's your full name?
Please upload complete solution to your GitHub account for verification and review by our team!
from ocelot.
Ocelot 18.0.0 working but Ocelot 22.0.1 not working.
Deleted UpstreamHost. Working. But i want to seperate upstreamhost.
Warnings;
requestId: 0HN0MJFAEUU8F:00000009, previousRequestId: No PreviousRequestId,
message: 'Error Code: UnableToFindDownstreamRouteError
Message: Failed to match Route configuration for upstream path: /test/WeatherForecast, verb: GET.
errors found in ResponderMiddleware.
Setting error response for request path:/test/WeatherForecast, request method: GET'
requestId: 0HN0MJFAEUU8F:00000009, previousRequestId: No PreviousRequestId,
message: 'DownstreamRouteFinderMiddleware setting pipeline errors. IDownstreamRouteFinder returned Error Code: UnableToFindDownstreamRouteError
Message: Failed to match Route configuration for upstream path: /test/WeatherForecast, verb: GET.'
My ocelot.json
👉
{
"Routes": [
{
"DownstreamPathTemplate": "/{everything}",
"UpstreamPathTemplate": "/test/{everything}",
"UpstreamHttpMethod": [
],
"DownstreamHttpMethod": null,
"AddHeadersToRequest": {
},
"UpstreamHeaderTransform": {
},
"DownstreamHeaderTransform": {
},
"AddClaimsToRequest": {
},
"RouteClaimsRequirement": {
},
"AddQueriesToRequest": {
},
"ChangeDownstreamPathTemplate": {
},
"RequestIdKey": null,
"FileCacheOptions": {
"TtlSeconds": 0,
"Region": null
},
"RouteIsCaseSensitive": false,
"ServiceName": null,
"ServiceNamespace": null,
"DownstreamScheme": "https",
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 0,
"DurationOfBreak": 0,
"TimeoutValue": 0
},
"LoadBalancerOptions": {
"Type": null,
"Key": null,
"Expiry": 0
},
"RateLimitOptions": {
"ClientWhitelist": [
],
"EnableRateLimiting": false,
"Period": null,
"PeriodTimespan": 0.0,
"Limit": 0
},
"AuthenticationOptions": {
"AuthenticationProviderKey": null,
"AllowedScopes": [
]
},
"HttpHandlerOptions": {
"AllowAutoRedirect": false,
"UseCookieContainer": false,
"UseTracing": false,
"UseProxy": true,
"MaxConnectionsPerServer": 2147483647
},
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 7071
}
],
"UpstreamHost": "localhost:6001",
"Key": null,
"DelegatingHandlers": [
],
"Priority": 1,
"Timeout": 0,
"DangerousAcceptAnyServerCertificateValidator": false,
"SecurityOptions": {
"IPAllowedList": [
],
"IPBlockedList": [
]
},
"DownstreamHttpVersion": null
}
],
"DynamicRoutes": [
],
"Aggregates": [
],
"GlobalConfiguration": {
"RequestIdKey": null,
"ServiceDiscoveryProvider": {
"Scheme": null,
"Host": null,
"Port": 0,
"Type": null,
"Token": null,
"ConfigurationKey": null,
"PollingInterval": 0,
"Namespace": null
},
"RateLimitOptions": {
"ClientIdHeader": "ClientId",
"QuotaExceededMessage": null,
"RateLimitCounterPrefix": "ocelot",
"DisableRateLimitHeaders": false,
"HttpStatusCode": 429
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 0,
"DurationOfBreak": 0,
"TimeoutValue": 0
},
"BaseUrl": "https://localhost:6001",
"LoadBalancerOptions": {
"Type": null,
"Key": null,
"Expiry": 0
},
"DownstreamScheme": null,
"HttpHandlerOptions": {
"AllowAutoRedirect": false,
"UseCookieContainer": false,
"UseTracing": false,
"UseProxy": true,
"MaxConnectionsPerServer": 2147483647
},
"DownstreamHttpVersion": null
}
}
from ocelot.
@nrllhylmz commented on Jan 16:
I delete "UpstreamHost":"localhost:6001" and it worked.
I want to use "UpstreamHost"
But why do you need to use UpstreamHost
if you have single route in development environment?
Maybe some firewall tool will help you? 😄
Read UpstreamHost docs and you will get that feature is based on Host
header! You just cannot make request from Ocelot instance app to itself!
Your very zipped JSON
{
"Routes": [
{
"DownstreamPathTemplate": "/{everything}",
"UpstreamPathTemplate": "/test/{everything}",
"DownstreamScheme": "https",
"DownstreamHostAndPorts": [
{
"Host": "localhost", "Port": 7071
}
],
"UpstreamHost": "localhost:6001",
}
],
"GlobalConfiguration": {
"BaseUrl": "https://localhost:6001",
"DownstreamHttpVersion": null
}
}
Don't you see the issue?
You cannot use "UpstreamHost" with value localhost:6001
because "BaseUrl" is https://localhost:6001
!!!
You cannot make requests from Ocelot instance to itself!
"UpstreamHost" property is used to filter incoming requests from various domains in DNS form but not from Base URL of Ocelot host & port! It is impossible!
That is why you have error: Failed to match Route configuration for upstream path: /test/WeatherForecast
which says that Ocelot cannot find route!
What are you doing? 🤯
from ocelot.
Nurullah Yılmaz!
I recommend you to
- start reading Ocelot docs from very beginning.
- start using DNS and dev & test API tools like Postman
I see misconfiguration problem which should be fixed by your own.
Our all tests are green and UpstreamHost feature should not be broken.
For invalid configs the feature can be broken.
from ocelot.
Your next created #1926 will be checked by our QA engineer... You can talk to him.
from ocelot.
Related Issues (20)
- 在使用异步流返回时,并不是实时刷新逐条返回结果,而是一次返回结果 HOT 10
- How to Authorize with nested JWT claim generated from Keycloak
- Access to the path '/app/ocelot.json' is denied HOT 1
- Ocelot is missing NuGet package README file HOT 3
- Kubernetes provider should identify different ports HOT 14
- FTP is raising Exception of Timeout but working in FileZilla and WinSCP HOT 3
- UnableToFindDownstreamRouteError, Failed to match Route configuration for upstream path: /, verb: GET HOT 8
- Rate Limiting issues in Ocelot HOT 6
- Ocelot Downstream Request Timeout HOT 5
- How to find servicename on PreAuthorizationMiddleware HOT 1
- Proposal to add ExtraProps to the configuration HOT 5
- Regression at DownstreamUrlCreatorMiddleware HOT 7
- Enhancing Ocelot to Automatically Forward Claims from IdentityServer's Introspection Endpoint to Backend Services HOT 1
- how to document rate limit in swagger HOT 1
- Release 23.2: UpstreamPathTemplate doesn't contain the same placeholders in DownstreamPathTemplate HOT 12
- Long duration of CircleCI builds HOT 1
- Map response of rate limit quota into exception
- On the fly `ocelot.json` configuration merging HOT 1
- Body cannot be forwarded twice on Aggregator HOT 17
- 当下游服务返回"text/plain"类型时导致"response.Body"中变得异常得长,这正常吗?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ocelot.