title: CORS Allow-Access-Control-Origin on Mobile Chrome
body: <p>I am getting an error on mobile, when I use Chrome to try out my new responsive web app. I have done everything from add php headers in several different ways, to passing headers in my ajax request. On the web, I used CORS toggle, a Chrome extension that allows you to toggle on and off CORS, which fixes the problem on web. Yet I cannot seem to find a solution like this for mobile. Anyway I can bypass CORS on mobile Chrome??</p>
  
  <p>I have tried ALL of these ways, and nothing seems to work..</p>
  
  <p>php option 1:</p>
  
  <pre><code>&lt;?php
    header('Access-Control-Allow-Origin: *');
    header('Access-Control-Allow-Headers: Cache-Control, Pragma, Origin, Authorization, Content-Type, X-Requested-With');
    header('Access-Control-Allow-Methods: GET, PUT, POST');
  ?&gt;
  </code></pre>
  
  <p>php option 2: </p>
  
  <pre><code>&lt;?php
      // Allow from any origin
      if (isset($_SERVER['HTTP_ORIGIN'])) {
          header("Access-Control-Allow-Origin: *");
          header("Access-Control-Allow-Credentials: true ");
          header("Access-Control-Allow-Methods: OPTIONS, GET, POST");
          header("Access-Control-Allow-Headers: Content-Type, Depth, User-Agent, X-File-Size, X-Requested-With, If-Modified-Since, X-File-Name, Cache-Control");
      }
  
      // 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);
      }
  
      echo "You have CORS!";
  ?&gt;
  </code></pre>
  
  <p>jQuery AJAX: </p>
  
  <pre><code>$.ajax({
            url: '&lt;MY API ENDPOINT&gt;',
            method: 'POST',
            headers: {
              'Access-Control-Allow-Origin': '*',
              'Access-Control-Allow-Headers': "Cache-Control, Pragma, Origin, Authorization, Content-Type, X-Requested-With",
              'Access-Control-Allow-Methods': "GET, PUT, POST",
              'Authorization':
                'Bearer &lt;MY TOKEN&gt;',
              'Cache-Control': 'no-cache'
            },
            data: formData,
            processData: false,
            contentType: false
          }).done(function(res) {
  </code></pre>