9f97b7f13f77d9fb65aa39b865845cd72db4ddfe
[prawokultury.git] / realip_middleware.py
1 class SetRemoteAddrFromXRealIP(object):
2     """Sets REMOTE_ADDR from the X-Real-IP header, as set by Nginx."""
3     def process_request(self, request):
4         try:
5             request.META['REMOTE_ADDR'] = request.META['HTTP_X_REAL_IP']
6         except KeyError:
7             return None