Closed JayChuah95 closed 7 months ago
Output Message
ApiGateway> Request starting HTTP/1.1 GET http://localhost:10000/Auth/GetStuff
ApiGateway> info: Ocelot.RateLimit.Middleware.ClientRateLimitMiddleware[0]
ApiGateway> requestId: 0HLR42UO95R3M:00000001, previousRequestId: no previous request id, message: EndpointRateLimiting is not enabled for /api/User/GetStuff
ApiGateway> info: Ocelot.Authentication.Middleware.AuthenticationMiddleware[0]
ApiGateway> requestId: 0HLR42UO95R3M:00000001, previousRequestId: no previous request id, message: No authentication needed for /Auth/GetStuff
ApiGateway> info: Ocelot.Authorisation.Middleware.AuthorisationMiddleware[0]
ApiGateway> requestId: 0HLR42UO95R3M:00000001, previousRequestId: no previous request id, message: /api/User/GetStuff route does not require user to be authorised
ApiGateway> info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
ApiGateway> Request finished in 7.2071ms 400 text/html; charset=us-ascii
@catcherwong May I know is there any issue on my configuration? Thanks for the help
@JayChuah95 Based on your sample, it seems that all things run well.
@catcherwong Thanks for the clarification. It seem like there is some issue on my localhost networking routing. Could you help with this? As I check on my httperr.log, it doesn't route to my localhost > ::1%0 20000
Hi @catcherwong It turn up is a networking issue. The fe80::xxxx:xxxx:xxxx:xxxx%20 is my link-local ipv6 address.
It seem like the ipv6 address is not working. May I know what is the means by "record the full URL address from API Gateway to downstream services"?
API Gateway will send HTTP requests to the downstream services, in your sample is AuthService
.
And what is the request URL here? http://localhost:30000/api/User/GetStuff
or http://fe80::xxxx:xxxx:xxxx:xxxx%20:30000/api/User/GetStuff
or others.
@catcherwong It suppose to be like the following example: Upstream > http://localhost:10000/Auth/GetStuff Then route to > http://localhost:20000/api/User/GetStuff
The output when I call http://localhost:10000/Auth/GetStuff
Maybe you can change the default Log Level to Debug, ocelot will show more information for the request.
{
"spring": {
"application": {
"name": "Api-Gateway"
}
},
"eureka": {
"client": {
"serviceUrl": "http://localhost:8761/eureka",
"shouldRegisterWithEureka": true,
"shouldFetchRegistry": true,
"validateCertificates": false
},
"instance": {
"port": 10000
}
},
// add the following section.
"Logging": {
"LogLevel": {
"Default": "Debug"
}
},
"AppSettings": {
"Secret": "0265776e-b490-4253-9be4-7d73457700b1"
}
}
@catcherwong The Downstream url is http://obest157:20000/api/User/GetStuff
obest157 is my computer name
When you access http://obest157:20000/api/User/GetStuff
, can you get the right result or Bad Request
?
@catcherwong Bad Result on the url
You should resolve this problem at first, why you can not access this url normally?
@catcherwong I think this is a networking issue? It can be access if I changed it to localhost:20000 instead of the computer name
I guess this could be a issue for some network settings as well.
Temperary Solution
go to .vs\config
and change the applicationhost.config
Modify from
<binding protocol="http" bindingInformation="*:20000:localhost" />
to
<binding protocol="http" bindingInformation="*:20000:*" />
Hi @JayChuah95 ! Is it still the issue? 😄
It seem like there is some issue on my localhost networking routing. https://github.com/ThreeMammals/Ocelot/issues/1053#issuecomment-553183891
Seems it was the discussion of 2 DevOps engineers :rofl:
Not Ocelot issue!
Expected Behavior
Reroute to /api/User/GetStuff
Actual Behavior
Bad Request - Invalid Hostname HTTP Error 400. The request hostname is invalid.
Steps to Reproduce the Problem
Project Link: https://github.com/JayChuah95/AntyChatty/tree/master/AntyChatty
My ocelot.json
AuthService appsettings.json
Specifications