tag:support.appharbor.com,2010-11-23:/discussions/problems/20669-appharbor-and-cors-using-pre-flight-options-request AppHarbor: Discussion 2018-10-19T03:06:56Z tag:support.appharbor.com,2010-11-23:Comment/24569160 2013-02-04T17:54:17Z 2013-02-04T17:54:18Z AppHarbor and CORS using pre-flight OPTIONS request <div><p>I also asked this question on Stack Overflow, and there's been some help coming through there.</p> <p><a href= "http://stackoverflow.com/questions/14596231/how-do-i-accept-cors-ajax-requests-on-appharbor"> http://stackoverflow.com/questions/14596231/how-do-i-accept-cors-aj...</a></p> <p>Removing WebDAV has led to nginx bouncing my requests with a 405 error instead of returning the 200 OK.</p> <p>Request</p> <p>OPTIONS $path HTTP/1.1<br> Host: $servername<br> Connection: keep-alive<br> Access-Control-Request-Method: POST<br> Origin: <a href="http://www.local">http://www.local</a><br> User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17<br> Access-Control-Request-Headers: accept, origin, content-type<br> Accept: /<br> Referer: <a href= "http://www.local/wordpress/2013/01/request-url-test/">http://www.local/wordpress/2013/01/request-url-test/</a><br> Accept-Encoding: gzip,deflate,sdch<br> Accept-Language: en-GB,en;q=0.8,en-US;q=0.6<br> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3</p> <p>Response</p> <p>HTTP/1.1 405 Method Not Allowed<br> Server: nginx<br> Date: Mon, 04 Feb 2013 17:09:19 GMT<br> Content-Type: application/json; charset=utf-8<br> Content-Length: 76<br> Connection: keep-alive<br> Cache-Control: no-cache<br> Pragma: no-cache<br> Expires: -1</p></div> Simon Gill tag:support.appharbor.com,2010-11-23:Comment/24569160 2013-02-04T23:51:27Z 2013-02-04T23:51:28Z AppHarbor and CORS using pre-flight OPTIONS request <div><p>WebDAV was to blame for the initial problem of not getting the full CORS headers in the response. The 405 error was a problem somewhere in the configuration of my app.</p> <p>After some digging into the internals, it appears that the CORSMessageHandler for use with WebAPI (provided by Thinktecture) wasn't correctly identifying preflight requests and those requests were routed through to the WebAPI object itself.</p> <p>I worked-around the issue by moving to the IIS module instead of the WebAPI one. This may make life more difficult in the future, but at least it works.</p></div> Simon Gill tag:support.appharbor.com,2010-11-23:Comment/24569160 2013-02-05T02:00:30Z 2013-02-05T02:00:30Z AppHarbor and CORS using pre-flight OPTIONS request <div><p>Alright that's interesting - so it wasn't related to a configuration issue/snag on AppHarbor? It'd be interesting to know exactly what the issue was when you figure it out.</p> <p>Best,<br> Rune</p></div> rune tag:support.appharbor.com,2010-11-23:Comment/24569160 2013-02-05T03:15:03Z 2013-02-05T03:15:03Z AppHarbor and CORS using pre-flight OPTIONS request <div><p>I suspect there's a difference between the request hitting the app on my local development machine and what nginx is sending, but I haven't dug into that. If Thinktecture in IIS mode becomes a major problem I'll look into it again then.</p></div> Simon Gill