Having double slashes in url, `//` does not invoke middleware in the `/functions` โ sample code ๐
I am using middleware in /functions to secure some pages. But when the url has double slashes //, wrangler doesn't run the middleware for the url.
I have replicated the issue in a minimal repo here โ https://github.com/Shivam010/cloudflare-double-slashes-issue
There's a middleware in
And the
Now, the Problem...
The middleware is properly invoked on
whenever someone uses a double slash before the middleware directory, it doesn't run the middleware and instead directly serve the pages.
Links:
Hosted on: https://double-slashes-issue.pages.dev
Middleware โ https://github.com/Shivam010/cloudflare-double-slashes-issue/blob/main/functions/secure/_middleware.js
---
Can somebody help me here!
I have replicated the issue in a minimal repo here โ https://github.com/Shivam010/cloudflare-double-slashes-issue
There's a middleware in
/functions/secure directory to be applied on all routes of /secure โ https://github.com/Shivam010/cloudflare-double-slashes-issue/blob/main/functions/secure/_middleware.jsAnd the
/out/secure directory contains a file one.html which should be served at /secure/one (but first the middleware needs to be invoked)Now, the Problem...
The middleware is properly invoked on
/secure/one route but not on the //secure/one, whenever someone uses a double slash before the middleware directory, it doesn't run the middleware and instead directly serve the pages.
Links:
Hosted on: https://double-slashes-issue.pages.dev
/secure/one route https://double-slashes-issue.pages.dev/secure/one//secure/one route https://double-slashes-issue.pages.dev//secure/oneMiddleware โ https://github.com/Shivam010/cloudflare-double-slashes-issue/blob/main/functions/secure/_middleware.js
---
Can somebody help me here!
GitHub
Contribute to Shivam010/cloudflare-double-slashes-issue development by creating an account on GitHub.
GitHub
Contribute to Shivam010/cloudflare-double-slashes-issue development by creating an account on GitHub.
