Comments (5)
Hi @juanretamales I suspect this is a problem with your code, where 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'
is the key point:
request.client
is None in your execution, I don't think this has anything to do with slowapi
.
from slowapi.
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.
from slowapi.
Hi @juanretamales
If I'm not wrong, this error happens when your application is running behind a proxy such as nginx (maybe gunicorn as well).
You should make sure you correctly proxy the headers at the proxy level.
from slowapi.
Here is an example configuration that should do the trick, if you use nginx
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
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
from slowapi.
@juanretamales did the comment above help? if so can you close this issue?
from slowapi.
Related Issues (20)
- Can slowapi be used in production? HOT 1
- Is it possible to bump limitis package version up to 2.1? HOT 1
- @limiter.limit("1/second") not working HOT 5
- how to control limit by duration? HOT 4
- Do slowapi support rate limiting by parameters? HOT 1
- Encountered an error reporting: AttributeError: 'State' object has no attribute 'view_rate_limit' HOT 4
- Information on ratelimit-string HOT 3
- How to call in APIRouter'? HOT 2
- Add support for python 3.11 HOT 6
- New release/tag HOT 2
- Can global limits make this in FastAPI? HOT 3
- [QUESTION] redis asyncio-compatible? HOT 2
- Installation failure with poetry.core 1.5
- Can't set RATELIMIT_DEFAULT in .env HOT 4
- Dependency Dashboard
- Hi @smittysmee this is not my day job, it's 100% volunteer work, so priority may fall behind. The process for publishing an update is a bit manual still. If you want to give a hand with opening a PR to prepare for a release 0.1.8, I think a lot of people will be grateful. Examples from past releases #120 or #108. As a policy (see #58 ), I add any contributor who's had at least one PR merged to the repo, to help reduce bottlenecks. You're welcome to join the team!
- Features
- Feature | Can this support individual limits by IP address or user token? HOT 1
- slowapi uses limits==2.8.0 which contains usage of deprecated pkg_resources
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from slowapi.