Jump to content

Search the Community

Showing results for tags 'cors php js'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General Discussion
    • Website Management and Coding
    • Technology and the Internet
    • Philosophy, Politics, and Science
    • Art and Entertainment
    • Other Discussion
  • HelioHost
    • Questions
    • Customer Service
    • How You Can Help
  • HelioNet
    • News
    • Contact HelioNet

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 1 result

  1. Hi, I tried CORS (cross origin resource sharing), just because I have some JS using it. Is it disabled on the Johnny? I support it with the PHP script (setting header). It works on different web-hosts. Specifically I get the following error in Chrome and Firefox: 'No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.' Here is the code I used: PHP: // Allow from any origin if (isset($_SERVER['HTTP_ORIGIN'])) { header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}"); header('Access-Control-Allow-Credentials: true'); header('Access-Control-Max-Age: 86400'); // cache for 1 day } // Access-Control headers are received during OPTIONS requests if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') { if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD'])) header("Access-Control-Allow-Methods: GET, POST, OPTIONS"); if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'])) header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}"); exit(0); } // old: /* header("Access-Control-Allow-Origin: *"); header("Access-Control-Expose-Headers: Origin"); header('Access-Control-Allow-Methods: GET, POST'); header("Origin: ".CURRENT_HOST); */ Issue solved after doing some research again: In some other included PHP scripts there was a blank line before "&--#60;?php". This caused already output disallowing any headers to be set. web development... Btw. it seems like I can't set the title to [solved] myself
×
×
  • Create New...