-
Notifications
You must be signed in to change notification settings - Fork 80
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
Error in production #116
Comments
Hi @juanretamales I suspect this is a problem with your code, where
|
i search and the problem is when you use gunicorn (here has the problem), i suggest any method or option for skip the error when appears. |
Hi @juanretamales |
Here is an example configuration that should do the trick, if you use nginx
EDIT: also with this, for security reason you should add some middleware (for example this one from starlette) to avoid your clients forging their host/ip |
@juanretamales did the comment above help? if so can you close this issue? |
Describe the bug
Use Gunicorn in production
To Reproduce
Use gunicorn for start and call a endpoint with limit
Expected behavior
do nothing
Screenshots
If applicable, add screenshots to help explain your problem.
Oct 25 20:16:46 gunicorn[12540]: return await dependant.call(**values) Oct 25 20:16:46 gunicorn[12540]: File "/home/ubuntu/proyect/api/env/lib/python3.10/site-packages/slowapi/extension.py", line 635, in async_wrapper Oct 25 20:16:46 gunicorn[12540]: self._check_request_limit(request, func, False) Oct 25 20:16:46 gunicorn[12540]: File "/home/ubuntu/proyect/api/env/lib/python3.10/site-packages/slowapi/extension.py", line 535, in _check_request_limit Oct 25 20:16:46 gunicorn[12540]: self.__evaluate_limits(request, endpoint, all_limits) Oct 25 20:16:46 gunicorn[12540]: File "/home/ubuntu/proyect/api/env/lib/python3.10/site-packages/slowapi/extension.py", line 413, in __evaluate_limits Oct 25 20:16:46 gunicorn[12540]: limit_key = lim.key_func(request) Oct 25 20:16:46 gunicorn[12540]: File "/home/ubuntu/proyect/api/env/lib/python3.10/site-packages/slowapi/util.py", line 21, in get_remote_address Oct 25 20:16:46 gunicorn[12540]: return request.client.host or "127.0.0.1" Oct 25 20:16:46 gunicorn[12540]: AttributeError: 'NoneType' object has no attribute 'host'
Your app (please complete the following information):
Additional context
y set the api in production, and get this error
The text was updated successfully, but these errors were encountered: