Last active
December 29, 2015 12:19
-
-
Save notslang/7670196 to your computer and use it in GitHub Desktop.
add this to the top of the main contact form 7 file to fix its lack of CORS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (isset($_SERVER['HTTP_ORIGIN']) && in_array($_SERVER['HTTP_ORIGIN'], array('http://chazsouthard.com', 'http://localhost:1111'))) { | |
header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}"); | |
header('Access-Control-Allow-Credentials: true'); | |
header('Access-Control-Max-Age: 86400'); // cache for 1 day | |
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment