I’m working on a website using django. I did a port forwarding in my website and after that POST is not working because csrf is failing. I’m using a custom port for my website everytime.
Can anyone please give me some suggestions to fix this ?
ONE FIX : I used csrf_exempt but that is not a good solution
What specifically is the mechanism that you’re using to do this? Are you replacing any HTTP headers in the process? Is anything filtering cookies?
The csrf_token creation process has no way of knowing what ports are being served. See Cross Site Request Forgery protection | Django documentation | Django. The port forwarding itself is not the cause of this issue.