Skip to content

fix: share generated HEAD route rate limits - #466

Open
mcollina wants to merge 1 commit into
mainfrom
fix/share-generated-head-rate-limit
Open

mcollina wants to merge 1 commit into
mainfrom
fix/share-generated-head-rate-limit

Conversation

@mcollina

Copy link
Copy Markdown
Member

Share a route-level rate-limit store between a GET route and the HEAD routes Fastify generates from it. Explicit HEAD routes and routes with distinct constraints retain independent stores, including prefixed trailing-slash aliases and Redis or custom stores.

@gurgunday gurgunday left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine

but it's about 200 lines of guessing which HEAD routes fastify generated by matching URL, prefix and constraints

it would be simpler if fastify core flagged its generated HEAD routes in onRoute since it already tracks them internally

@mcollina

Copy link
Copy Markdown
Member Author

Opened fastify/fastify#7155 to expose isGeneratedHeadRoute in onRoute. Once that lands in a Fastify release, this PR can use the authoritative flag instead of inferring generated routes from route metadata.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants