Closed mabiede closed 3 years ago
FYI: After several tests, I think the middleware is fine, but I'm still experiencing this issue.
let router = choose
[ get "/" Handler.Public.index
; get "" Handler.Public.index ]
Results in routes_of_router
:
GET /
GET /
And with the trailing_slash
middleware, it matches both to ""
--> Results in 404 not found.
Occurs with Sihl.1.0.0~rc2.
(Sihl.1.0.0~rc1 can have a routes_of_router
GET
(without slash))
@mabiede Thanks for the detailed bug report! Fixed and merged: https://github.com/oxidizing/sihl/pull/507
I briefly considered turning a request to ////
into /
as well, but I am not sure yet whether this is the responsibility of the trailing slash middleware.
@jerben I had issues with the trailing slash middleware.
get
route to theindex
page on""
(or"/"
)localhost:3000
)Behaviour description: The request to "/" is dropped by the trailing slash middleware and "" (empty string) cannot be matched in routes and a 404 is returned.
Adding an additional statement to check if uri is equal to root solves the issue:
Related file: https://github.com/oxidizing/sihl/blob/master/sihl/src/web_trailing_slash.ml