Note that there are some explanatory texts on larger screens.

plurals
  1. POHTTP OPTIONS request on Azure Websites fails due to CORS
    primarykey
    data
    text
    <p>I've recently moved our servers from Rackspace CloudSites (running on Apache/Linux) to Windows Azure Websites. Since the migration, all the jQuery AJAX requests on our REST API have started failing due to CORS.</p> <p>We use custom headers, so jQuery makes a Pre-flight HTTP OPTIONS request before running the actual API calls. The problem is that the OPTIONS request doesn't seem to reach my PHP code and is instead returned by some other entity (obviously the Web Server) which I seem to have no control over.</p> <p>I have been using the following headers for a couple of years now so I'm pretty sure the problem isn't in the PHP code:</p> <pre><code>&lt;?php $this-&gt;output-&gt;set_header("Access-Control-Allow-Origin: *"); $this-&gt;output-&gt;set_header("Access-Control-Allow-Methods: GET,POST,DELETE,HEAD,PUT,OPTIONS"); $this-&gt;output-&gt;set_header("Access-Control-Allow-Headers: X-Olaround-Debug-Mode, Authorization, Accept"); $this-&gt;output-&gt;set_header("Access-Control-Expose-Headers: X-Olaround-Debug-Mode, X-Olaround-Request-Start-Timestamp, X-Olaround-Request-End-Timestamp, X-Olaround-Request-Time, X-Olaround-Request-Method, X-Olaround-Request-Result, X-Olaround-Request-Endpoint" ); ?&gt; </code></pre> <p>I'm guessing the problem is specific to Azure Websites since the code seems to working fine on my development machine (Windows 8 / IIS 8.0) as well. I'm new to Azure (and Windows based hosting in general) so I have almost no clue on how to approach and debug this issue since Azure Websites allow very minimal control.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload