Advertisement
magma1447

send2cgeo CORS

Jun 26th, 2015
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.71 KB | None | 0 0
  1. /*
  2. Cross site requests
  3. http://stackoverflow.com/questions/13457772/cors-ajax-session-cookies-access-control-allow-credentials-withcredentials
  4. http://stackoverflow.com/questions/13954080/cross-domain-jquery-ajax-call-with-credentials
  5. */
  6. if(isset($_SERVER['HTTP_ORIGIN']))
  7. {
  8.     if($_SERVER['HTTP_ORIGIN'] == 'http://project-gc.com' || $_SERVER['HTTP_ORIGIN'] == 'https://project-gc.com')
  9.     {
  10.         header('Access-Control-Allow-Origin: '.$_SERVER['HTTP_ORIGIN']);
  11.         header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS');
  12.         header('Access-Control-Max-Age: 3600');
  13.         header('Access-Control-Allow-Headers: Content-Type, Authorization, X-Requested-With');
  14.         header('Access-Control-Allow-Credentials: true');
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement