Reputation: 1331
I've got two different django projects, where one sits on domain A and has a bunch of functionalities (REST among them). Site B is simple and I want to post ajax-forms to site A, but keep csrf security. Is that possible?
Btw sites can share database if necessary.
Upvotes: 5
Views: 2194
Reputation: 2204
I've had a simillar problem and I've managed to solve it in the following way:
The main problem for me was to get cross-site ajax requests to work. To achieve that I've had to configure CORS correctly on the server-side (I've slightly edited this middleware: https://gist.github.com/strogonoff/1369619) and set xmlHttp.withCredentials = true
(where xmlHttp is my XMLHttpRequest object) in the ajax POST function.
I've tested this solution on two diffenet ports on the same IP address, but I think it should also work cross-domain.
Upvotes: 3