Skip to content
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

Issue with Trailing Slashes in URLs Preventing Middleware Execution in Astro #12537

Open
1 task
rajpatel2435 opened this issue Nov 26, 2024 · 0 comments
Open
1 task
Labels
needs triage Issue needs to be triaged

Comments

@rajpatel2435
Copy link

rajpatel2435 commented Nov 26, 2024

Hello @tordans @altano @madbook

Astro Info

Astro                    v4.5.2
Node                     v20.9.0
System                   Windows (x64)
Package Manager          npm
Output                   server
Adapter                  @astrojs/node
Integrations             @astrojs/tailwind

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

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

1 participant