Error. Status=0 when 'FORCE_SSL_ADMIN'=true and associated fix
-
Hi,
I recently had Error.Status=0 when submitting the ajax form on my blog.
I investigated, and the url for the ajax form was
https://XXXXX/wp-admin/admin-ajax.php while I was not using https on the current page.According to http://en.wikipedia.org/wiki/Same-origin_policy
We can’t have an http url call an https one with ajax.
I looked at the code and I noticed you were using admin_url(‘admin-ajax.php’) to find the admin-ajax.php page path.
And according to the documentation of this function (http://codex.wordpress.org/Function_Reference/admin_url)
if $scheme parameter is ommited :
Default is ‘admin’, which obeys force_ssl_admin() and is_ssl()
This means that If I am not in ssl (is_ssl() returns false)
and force_ssl_admin() == true, then I would have an https:// that will cause a cross-origin call!
My fix is to check is_ssl() directly in easy-contact-forms-customforms.php line 1982 :$ajaxurl = $as->get('FixStatus0') ? home_url('wp-admin/admin-ajax.php') : admin_url('admin-ajax.php',is_ssl()?'https':'http');Please tell me if it helps someone or if my fix looks bad.
Thanks
The topic ‘Error. Status=0 when 'FORCE_SSL_ADMIN'=true and associated fix’ is closed to new replies.