From 0be4d64487537fe5fe220cfb8896c4da08bb22a8 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Wed, 18 Jun 2014 14:35:38 -0400 Subject: [PATCH] Fixed #22859 -- Improved crossDomain technique in CSRF example. Thanks flisky for the report. --- docs/ref/contrib/csrf.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/ref/contrib/csrf.txt b/docs/ref/contrib/csrf.txt index b1dd2a0ff0e..29fa56de8ac 100644 --- a/docs/ref/contrib/csrf.txt +++ b/docs/ref/contrib/csrf.txt @@ -186,9 +186,8 @@ jQuery 1.5 and newer in order to replace the ``sameOrigin`` logic above: return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method)); } $.ajaxSetup({ - crossDomain: false, // obviates need for sameOrigin test beforeSend: function(xhr, settings) { - if (!csrfSafeMethod(settings.type)) { + if (!csrfSafeMethod(settings.type) && !this.crossDomain) { xhr.setRequestHeader("X-CSRFToken", csrftoken); } }