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

Enabled caching and RateLimitMiddleware duplicate all Ratelimt-* headers in response #3625

Open
2 of 4 tasks
mikhail-tokarev opened this issue Jul 12, 2024 · 0 comments
Open
2 of 4 tasks
Labels
Bug 🐛 This is something that is not working as expected

Comments

@mikhail-tokarev
Copy link

mikhail-tokarev commented Jul 12, 2024

Description

with litestar.middleware.rate_limit.RateLimitMiddleware added to app middleware and cache=True enabled on route handler you can observe duplicates for all Ratelimit-* response headers like this:

Screenshot 2024-07-12 at 10 26 17

URL to code causing the issue

No response

MCVE

from litestar import Litestar, MediaType, get
from litestar.middleware.rate_limit import RateLimitConfig

rate_limit_config = RateLimitConfig(rate_limit=("minute", 1), exclude=["/schema"])

@get("/", cache=True, media_type=MediaType.TEXT, sync_to_thread=False)
def handler() -> str:
    return "ok"

app = Litestar(route_handlers=[handler], middleware=[rate_limit_config.middleware])

Steps to reproduce

No response

Screenshots

No response

Logs

No response

Litestar Version

2.9.1

Platform

  • Linux
  • Mac
  • Windows
  • Other (Please specify in the description above)

Note

While we are open for sponsoring on GitHub Sponsors and
OpenCollective, we also utilize Polar.sh to engage in pledge-based sponsorship.

Check out all issues funded or available for funding on our Polar.sh dashboard

  • If you would like to see an issue prioritized, make a pledge towards it!
  • We receive the pledge once the issue is completed & verified
  • This, along with engagement in the community, helps us know which features are a priority to our users.
Fund with Polar
@mikhail-tokarev mikhail-tokarev added the Bug 🐛 This is something that is not working as expected label Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🐛 This is something that is not working as expected
Projects
None yet
Development

No branches or pull requests

1 participant