Open rajpatel2435 opened 6 days ago
Hi. It's not totally clear to me what you mean when you say the middleware is not executed correctly. Is it not executed at all, or in the wrong way? If the latter, wrong in what way. Can you provide a reproduction that includes the source code, ideally via stackblitz. Thanks
Hello @rajpatel2435. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with needs repro
will be closed if they have no activity within 3 days.
Hi @ascorbic
Issue is that when I type in browser with multiple trailing slashes
https://vegasaces.com/games/slots/////////
in Astro logs terminal I just got https://vegasaces.com/games/slots/
how can I fix that so I only have one trailing slashes in the end of URL?
https://github.com/rajpatel2435/Slotsparadise_Astro
Thanks
That's not something we can use as a minimal reproduction. Please create a minimal reproduction, ideally using astro.new and Stackblitz.
Hi @ascorbic
why in Astro terminal we are not getting URL with multiple trailing slash?
Thanks
That link shows a 404 page for me. Please see the instructions on creating a minimal reproduction. Please don't just share your whole site: you need to narrow it to the smallest example that reproduces the problem. It's usually best to start from a starter site rather than from your own site.
Hi @ascorbic
This is the minimal project structure
https://stackblitz.com/~/github.com/rajpatel2435/slots?file=.env&initialPath=/how-to-play///
Thanks
Hello @tordans @altano @madbook
Astro Info
If this issue only occurs in one browser, which browser is a problem?
All Browser
Describe the Bug
When accessing URLs with multiple trailing slashes, such as:
https://vegasaces.com/games/slots/lucky-dama-muerta////////// The URL is automatically normalized in the backend to:
/games/slots/lucky-dama-muerta/
However, this normalization seems to bypass middleware logic. As a result, middleware doesn't execute as expected for the raw incoming URL.
Steps to Reproduce:
Create an Astro project with a middleware to log requests or process specific slugs. Access a URL with multiple trailing slashes (e.g., //////////). Observe that the middleware does not execute correctly for the normalized path.
What's the expected result?
Astro should identify and process URLs with multiple trailing slashes correctly, ensuring middleware functions execute as intended.
Current Behavior: URLs with trailing slashes are normalized by Astro, but middleware logic does not handle the original raw URL, causing inconsistencies.
Link to Minimal Reproducible Example
https://vegasaces.com/games/slots/lucky-dama-muerta//////////
Participation