litestar
litestar copied to clipboard
Enabled caching and RateLimitMiddleware duplicate all `Ratelimt-*` headers in response
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:
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
- [X] Linux
- [X] 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.