Allows AJAX requests from other sites to integrate content from your site using the CORS standard.
My use case is to allow content authors to write help pages in WordPress.
This content is fetched and embedded into a single page application hosted on another domain.
AJAX requests to this site from another are typically disallowed by the browser’s security model.
To permit legitimate uses the requesting browser may include an Origin header containing its domain.
This plugin uses the Origin header to decide whether to allow the request or not.
Allowed domains can be specified in the plugin’s Settings page.
This section describes how to install the plugin and get it working.
wp-cors.zip
to the /wp-content/plugins/
directoryIf you want to integrate content from your site to JavaScript applications running on other host domains (or allow other people to) then the CORS standard is a way to allow this.
CORS is more modern and more secure since it works with the browser’s same-origin policy and XmlHttpRequest objects rather than bypassing them.
You can find the CORS spec here: http://www.w3.org/TR/cors/ You can learn more about how to use CORS here: http://www.html5rocks.com/en/tutorials/cors/
This plugin’s Settings page allows administrators to specify a comma separated list of allowed domains.
Tested up to WordPress 6.2.2
Prevent cross-site script injection on Settings page (CVE-2022-47606).
Note this vulnerability may only be exploited if the user is already logged in with Admin privilege.
Tested up to WordPress 4.3
Minor fixes to avoid 404 on (unnecessary) files.
Publish on WordPress.org.
Stop debugging statements flooding the error log.
Initial proof of concept.