title: Phonegap Ajax CORS Request Proxy
body: <p>I've seen a thousand threads addressing CORS, and none of them helped. I have a phonegap application that cannot make ajax requests because it seems it's going through a proxy. The ajax is quite simple. </p>
  
  <pre><code>$.ajax({
      url        : base_url + "submit_git",
      type       : "GET",
      crossDomain: true,
      data       : {
          firstName: firstName,
          lastName : lastName,
          email    : email,
          phone    : phone,
          comments : comments
      },
      dataType   : "json"
  });
  </code></pre>
  
  <p>When I <code>console.log</code> the url, it gives me the correct url. When I follow the url, it returns the correct json, no 500 error. When I look at the console, I see the URL I'm requesting <em>prepended</em> with <code>http://192.168.1.109:3000/proxy/</code>. Following this I am returned with a blank page and a 500 error in the console. So it would seem that somehow phonegap thinks I want to go through this proxy. When I look in the phonegap logs I see </p>
  
  <pre><code>Proxy error for url: http://correcturl.com/page?query undefined
  500 http://correcturl.com/page?query
  </code></pre>
  
  <p>I've added the cordova whitelist plugin and added <code>&lt;access origin="*" subdomains="true" /&gt;</code> and this did nothing. </p>
  
  <p>I've added </p>
  
  <pre><code>$.support.cors                 = true;
  $.mobile.allowCrossDomainPages = true;
  </code></pre>
  
  <p>And this did nothing. </p>
  
  <p>I added <code>ProxyRequests Off</code> to the .htaccess, and this did nothing.</p>
  
  <p>I added <code>&lt;meta http-equiv="Content-Security-Policy" content="connect-src *" /&gt;</code> to my head, and this did nothing.</p>
  
  <p>I <strong>am</strong> able to do a jsonp request to the same server without any issues. Any ideas?</p>
  
  <p><strong>UPDATE 1</strong>: 
  I'm finding that this only happens when using the <code>phonegap serve</code> command and following the given IP. I was able to remove all phonegap files, upload just my html, css, and js and the request works fine. </p>
  
  <p><strong>UPDATE 2</strong>:<br>
  Well, I decided to develop and debug on a regular web server &amp; localhost, then submit my changes to <a href="https://build.phonegap.com/apps" rel="nofollow">build.phonegap.com</a> by zipping the contents of my www folder created w/ phonegap. Not technically a solution to the original issue, but it allows me to develop, debug then test on my phone.</p>