I want to create a localhost-only API in Django and I'm trying to find a way to restrict the access to a view only from the server itself (localhost)? I've tried using:
- 'HTTP_HOST',
- 'HTTP_X_FORWARDED_FOR',
- 'REMOTE_ADDR',
- 'SERVER_ADDR'
but with no luck.
Is there any other way?