How to pass CSRF
token between Django
applications by reading it from request using urllib
.
I am having two servers running with Django
applications, based on URL need to send request to other server and give the response back.
Django middelware
either returns None
or Response
.
In case of None
: it processes request on same server.
In case of Response
: it sends the response bake to client and bypassing request to same server.
Say I have two servers "S1" and "S2", and for URL ("/user/1/profile"
) I have to send request to "S2".
I am doing request cloning in django middleware which checks the matching URL and makes https request(using urllib) with all cookies and headers to "S2" server and sending response back by converting it from urllib-response to django-response.
With "GET" requests its working fine, but I am getting "403 CSRF" with "POST" requests.
Any suggestions what I am missing here.