hazee
By:
hazee

Wordpress Toolset plugin not working correctly because of CORS problem

February 15, 2017 301 views
WordPress DigitalOcean

this is the error the support staff at Toolset identified:


XMLHttpRequest cannot load http://pitcherlist.com/wp-admin/admin-ajax.php?wpv_force_one_query_arg=view…c52&action=wpv_shortcode_gui_dialog_create&shortcode=wpv-user&post_id=1836. Redirect from 'http://pitcherlist.com/wp-admin/admin-ajax.php?wpv_force_one_query_arg=view…c52&action=wpv_shortcode_gui_dialog_create&shortcode=wpv-user&post_id=1836' to 'http://www.pitcherlist.com/wp-admin/admin-ajax.php?wpv_force_one_query_arg=…c52&action=wpv_shortcode_gui_dialog_create&shortcode=wpv-user&post_id=1836' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://www.pitcherlist.com' is therefore not allowed access.


And then Digital Ocean's support staff responded with this:

"This is a CORS error, which is occurring due to security policies set up on your Droplet. However it's the fourth major error I see in the console, behind these three:

Uncaught TypeError: $ is not a function
at scripts.js?ver=1.0.0:20
bplayer-sm2.js:28 Uncaught ReferenceError: soundManager is not defined
at bplayer-sm2.js:28
bplayer-sm2.js:28 Uncaught ReferenceError: soundManager is not defined
at bplayer-sm2.js:28

In troubleshooting errors like this, it's often the case that the first error is causing later errors. I'd recommend troublehshooting those errors in order before working on this CORS problem, it may take care of itself."


How would I go about troubleshooting this?

1 Answer

@hazee

The best course of action would be to take this to the developers of the plugins that add the JS files that you're running in to issues with as troubleshooting on your own, without their help, would result in you potentially modifying the files and then having to redo it when an upgrade is released and you forget about the changes you've made.

So to start, you'd want to identify what plugin is adding scripts.js and bplayer-sm2.js. You would then test by disabling them, seeing if things are working, then enabling to see if you can replicate the same issue. If you can replicate it, take this to the developers on GitHub or via e-mail (depending on what they use) and let them address it.

Have another answer? Share your knowledge.