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

does't work on IIS #22

Open
maxiaojunwolf opened this issue Jun 20, 2022 · 1 comment
Open

does't work on IIS #22

maxiaojunwolf opened this issue Jun 20, 2022 · 1 comment

Comments

@maxiaojunwolf
Copy link

maxiaojunwolf commented Jun 20, 2022

it works when i use uvicorn to start ther server,but HTTP 500 when i start it by IIS

@maxiaojunwolf
Copy link
Author

maxiaojunwolf commented Jun 20, 2022

the reason is:
the 'on_startup' function does't be called on IIS,so the "await FastAPILimiter.init(cache)"also does't be called

my solution:
try to call FastAPILimiter.init on server starting,
FastAPILimiter.redis = cache
FastAPILimiter.prefix = "fastapi-limiter"
FastAPILimiter.identifier = default_identifier
FastAPILimiter.callback = default_callback
FastAPILimiter.lua_sha = 'a3f9e982197e9e887f6b5dcb7ec273863bb83aad' (use uvicorn start first get the SHA value,otherwise you need an async function,actual you can use this value direct)

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

No branches or pull requests

1 participant