Hello, i am trying to whitelist my namecheap server in my django app. Lets say my namecheap server is '123.456.789.2'. I have described a class below to make sure the ip of the client server matches the name cheap server but i am getting a different ip, lets say 193.432.53.240. How can i solve this
class IpMiddleware:
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
client_ip = request.META.get('HTTP_X_REAL_IP')
print(client_ip)
if client_ip not in settings.ALLOWED_IPS:
return HttpResponseForbidden("Access Denied")
response = self.get_response(request)
return response
[edit by admin: formatting]