un33k / django-ipware

A Django application to retrieve client's IP address

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add middleware for easy usage

wolph opened this issue · comments

I'm aware that writing the middleware manually is just a few lines of code but it would be very useful to have a simple middleware available

Within views it's easy enough to simply import the methods but Django still needs patching to have INTERNAL_IPS work correctly

@wolph ipware is to return the IP address. Each project knows what needs to be done with the IP. Best practice is to call ipware on the first request and cache it for subsequent use. Then use the IP as it fits the project requirements.

I don't get what you're trying to say...

I'm saying it would be useful to have a middleware integrated into the project. Something similar to this one: https://github.com/allo-/django-xforwardedfor-middleware/blob/master/x_forwarded_for/middleware.py

As for caching, that would be a useful thing to integrate into that middleware :)

@wolph I see ... just a simple thing to make IP available downstream ... cool.