Ребята здравствуйте! Теберь я буду жить с вами :)
Мой первый вопрос собственно в заголовке
Пытаюсь передать простой текст из min.example.com на api.example.com.
var data = $("form").serialize()
$.ajax({
url: 'http://api.example.com/v1/?' + data,
type: 'POST',
crossDomain: true,
success: function(response){
alert('ajax complide');
}
});
В итоге после отпарвки в консоле FF вижу [HTTP/1.0 403 FORBIDDEN 1036мс]
Заголовок ответа
X-Frame-Options: SAMEORIGIN
Server: WSGIServer/0.2 CPython/3.4.3
Date: Wed, 01 Jul 2015 11:34:13 GMT
Content-Type: text/html
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST,GET,OPTIONS,PUT,DELETE
Access-Control-Allow-Headers: Content-Type,*
Access-Control-Allow-Credentials: true
Тело ответа
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="robots" content="NONE,NOARCHIVE"> <title>403 Forbidden</title> <style type="text/css"> html * { padding:0; margin:0; } body * { padding:10px 20px; } body * * { padding:0; } body { font:small sans-serif; background:#eee; } body>div { border-bottom:1px solid #ddd; } h1 { font-weight:normal; margin-bottom:.4em; } h1 span { font-size:60%; color:#666; font-weight:normal; } #info { background:#f6f6f6; } #info ul { margin: 0.5em 4em; } #info p, #summary p { padding-top:10px; } #summary { background: #ffc; } #explanation { background:#eee; border-bottom: 0px none; } </style> </head> <body> <div id="summary"> <h1>Forbidden <span>(403)</span></h1> <p>CSRF verification failed. Request aborted.</p> <p>You are seeing this message because this site requires a CSRF cookie when submitting forms. This cookie is required for security reasons, to ensure that your browser is not being hijacked by third parties.</p> <p>If you have configured your browser to disable cookies, please re-enable them, at least for this site, or for 'same-origin' requests.</p> </div> <div id="info"> <h2>Help</h2>
Моя вьюшка, если нужна конечно
if request.method == "POST":
return HttpResponse("ok")
Я так понял django не дает кому попало выполнять POST.
Что делать?