-
Notifications
You must be signed in to change notification settings - Fork 458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Routing error with stub endpoint and dynamic endpoint sharing root path #423
Comments
Ok I did more investigation and updated previous comment and title due they were misleading |
Hello @alombarte! Issues mentioned by you are marked as closed but now I experience the same problem as @Rayzen on krakend 2.0.0. |
This issue is marked as stale because it has been open over 90 days with no activity. Remove the stale label or comment or this will be closed in 15 days. |
This issue was closed because it has been marked as stalled for 15 days with no activity. |
This issue was marked as resolved a long time ago and now has been automatically locked as there has not been any recent activity after it. You can still open a new issue and reference this link. |
Hi, I'm jut trying to write a KrakenD gateway config, but I'm facing a really strange behaviour.
This is the config I'm trying to implement
{
.....
"endpoints": [
{
"endpoint": "/myresource/{id1}/mysubresource/{id2}",
"output_encoding": "no-op",
"method": "GET",
"headers_to_pass": ["*"],
"querystring_params": ["*"],
"backend": [
{
"encoding": "no-op",
"host": [
"http://mybackend.local"
],
"url_pattern": "/mysubresource/{id1}-{id2}",
"method": "GET"
}
],
},
{
"endpoint": "/myresource/MYID/mysubresource",
"output_encoding": "no-op",
"method": "GET",
"headers_to_pass": ["*"],
"querystring_params": ["*"],
"backend": [
{
"encoding": "no-op",
"host": [
"http://mybackend.local"
],
"url_pattern": "/myresource/MYID/mysubresource",
"method": "GET"
}
],
}
]
}
The /myresource/MYID/mysubresource is a stub endpoint with mocked data, since the backend is not ready, but the final one should be /myresource/{id1}/mysubresource.
The /myresource/{id1}/mysubresource/{id2} instead is a real no-op endpoint.
So if I do a GET on /myresource/MYID/mysubresource or /myresource/MYID1/mysubresource/MYID2 (the first pathVariable is different) everything works fine, but if I do a GET on /myresource/MYID/mysubresource/MYID2 I have this error on krakend logs and no response:
2022/02/21 17:08:22 DEBUG: [2022/02/21 17:08:22 Handler: Actual request
2022/02/21 17:08:22 DEBUG: [2022/02/21 17:08:22 Actual request no headers added: missing origin
2022/02/21 17:08:22 http: panic serving 10.102.207.55:35290: invalid node type
goroutine 45 [running]:
net/http.(*conn).serve.func1(0xc000b18000)
/usr/local/go/src/net/http/server.go:1824 +0x153
panic(0x2415d00, 0x2d84640)
/usr/local/go/src/runtime/panic.go:971 +0x499
github.com/gin-gonic/gin.(*node).findCaseInsensitivePathRec(0xc0004dc850, 0xc000570039, 0x1a, 0xc0000ce300, 0x5, 0x80, 0xa6e69010000002f, 0x0, 0x0, 0x0)
/go/pkg/mod/github.com/gin-gonic/gin@v1.7.2/tree.go:790 +0x109b
github.com/gin-gonic/gin.(*node).findCaseInsensitivePathRec(0xc0004dc7e0, 0xc000570035, 0x1e, 0xc0000ce300, 0x1, 0x80, 0x10000002f, 0x7f057ff6f4a0, 0x7f055813bb01, 0x101000000000000)
/go/pkg/mod/github.com/gin-gonic/gin@v1.7.2/tree.go:706 +0x8af
github.com/gin-gonic/gin.(*node).findCaseInsensitivePathRec(0xc0004c2690, 0xc000570034, 0x1f, 0xc0000ce300, 0x0, 0x80, 0x100000073, 0xc000724601, 0xc0009347c0, 0x0)
/go/pkg/mod/github.com/gin-gonic/gin@v1.7.2/tree.go:706 +0x8af
github.com/gin-gonic/gin.(*node).findCaseInsensitivePath(0xc0004c2690, 0xc000570034, 0x1f, 0x1, 0x1a, 0x203000, 0xc, 0x2)
/go/pkg/mod/github.com/gin-gonic/gin@v1.7.2/tree.go:597 +0xb6
github.com/gin-gonic/gin.redirectFixedPath(0xc0008ec100, 0xc0004c2690, 0x1, 0xc000db0060)
/go/pkg/mod/github.com/gin-gonic/gin@v1.7.2/gin.go:557 +0x77
github.com/gin-gonic/gin.(*Engine).handleHTTPRequest(0xc0003b5a00, 0xc0008ec100)
/go/pkg/mod/github.com/gin-gonic/gin@v1.7.2/gin.go:498 +0x60d
github.com/gin-gonic/gin.(*Engine).ServeHTTP(0xc0003b5a00, 0x2de4d10, 0xc000aca000, 0xc0008ec000)
/go/pkg/mod/github.com/gin-gonic/gin@v1.7.2/gin.go:445 +0x15c
github.com/rs/cors.(*Cors).Handler.func1(0x2de4d10, 0xc000aca000, 0xc0008ec000)
/go/pkg/mod/github.com/rs/cors@v1.6.0/cors.go:207 +0x1b1
net/http.HandlerFunc.ServeHTTP(0xc000abfb00, 0x2de4d10, 0xc000aca000, 0xc0008ec000)
/usr/local/go/src/net/http/server.go:2069 +0x44
github.com/rs/cors.(*Cors).Handler.func1(0x2de4d10, 0xc000aca000, 0xc0008ec000)
/go/pkg/mod/github.com/rs/cors@v1.6.0/cors.go:207 +0x1b1
net/http.HandlerFunc.ServeHTTP(0xc000abfbc0, 0x2de4d10, 0xc000aca000, 0xc0008ec000)
/usr/local/go/src/net/http/server.go:2069 +0x44
net/http.serverHandler.ServeHTTP(0xc0009282a0, 0x2de4d10, 0xc000aca000, 0xc0008ec000)
/usr/local/go/src/net/http/server.go:2887 +0xa3
net/http.(*conn).serve(0xc000b18000, 0x2ded2f0, 0xc0001281c0)
/usr/local/go/src/net/http/server.go:1952 +0x8cd
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:3013 +0x39b
It seems like krakend it's messing up with routing request to the right endpoint, since /myresource/MYID/mysubresource and /myresource/MYID/mysubresource/MYID2 share the same root path, but I find quite strange that it breaks up on the latter endpoint example rather than on the former one...
The text was updated successfully, but these errors were encountered: