{"action":"created","issue":{"url":"https://api.github.com/repos/OData/ODataSamples/issues/29","labels_url":"https://api.github.com/repos/OData/ODataSamples/issues/29/labels{/name}","comments_url":"https://api.github.com/repos/OData/ODataSamples/issues/29/comments","events_url":"https://api.github.com/repos/OData/ODataSamples/issues/29/events","html_url":"https://github.com/OData/ODataSamples/issues/29","id":98871744,"number":29,"title":"Sample services don't support CORS, which makes JS clients hard to consume","user":{"login":"dingeins","id":5711156,"avatar_url":"https://avatars.githubusercontent.com/u/5711156?v=3","gravatar_id":"","url":"https://api.github.com/users/dingeins","html_url":"https://github.com/dingeins","followers_url":"https://api.github.com/users/dingeins/followers","following_url":"https://api.github.com/users/dingeins/following{/other_user}","gists_url":"https://api.github.com/users/dingeins/gists{/gist_id}","starred_url":"https://api.github.com/users/dingeins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dingeins/subscriptions","organizations_url":"https://api.github.com/users/dingeins/orgs","repos_url":"https://api.github.com/users/dingeins/repos","events_url":"https://api.github.com/users/dingeins/events{/privacy}","received_events_url":"https://api.github.com/users/dingeins/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/OData/ODataSamples/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-08-04T01:51:26Z","updated_at":"2015-09-07T11:24:45Z","closed_at":null,"body":"The original issue is here: https://github.com/ODataOrg/odataorg.github.io/issues/66\r\n\r\nQuoting the author:\r\n\r\n> And thus can not be used from a web browser for testing JS, for instance.\r\nExample request:\r\n```\r\nOPTIONS http://services.odata.org/V3/Northwind/Northwind.svc/$metadata HTTP/1.1\r\nAccept: */*\r\nOrigin: http://localhost:50854\r\nAccess-Control-Request-Method: GET\r\nAccess-Control-Request-Headers: accept, maxdataserviceversion\r\nAccept-Encoding: gzip, deflate\r\nUser-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko\r\nHost: services.odata.org\r\nContent-Length: 0\r\nDNT: 1\r\nConnection: Keep-Alive\r\nPragma: no-cache\r\nMaxDataServiceVersion: 3.0\r\n```\r\n\r\n> and it's response:\r\n```\r\nHTTP/1.1 501 Not Implemented\r\nCache-Control: private\r\nContent-Length: 195\r\nContent-Type: application/xml;charset=utf-8\r\nExpires: Thu, 30 Jul 2015 18:31:03 GMT\r\nVary: *\r\nServer: Microsoft-IIS/8.0\r\nX-Content-Type-Options: nosniff\r\nDataServiceVersion: 1.0;\r\nX-AspNet-Version: 4.0.30319\r\nX-Powered-By: ASP.NET\r\nAccess-Control-Allow-Origin: *\r\nAccess-Control-Allow-Methods: GET\r\nAccess-Control-Allow-Headers: Accept, Origin, Content-Type, MaxDataServiceVersion\r\nAccess-Control-Expose-Headers: DataServiceVersion\r\n```\r\n\r\n> Notice the response headers claim to allow CORS, but the response is Not Implemented.\r\n\r\n> Workaround\r\n\r\n> None that I know. I'd tipically just uso JSONP, but $metadata can not be requested by JSONP.\r\n\r\nThe reporter was able to reproduce this problem against V2, V3 and V4 Northwind services. He hasn't tested TripPin services yet, but they may have the same problem."},"comment":{"url":"https://api.github.com/repos/OData/ODataSamples/issues/comments/138274365","html_url":"https://github.com/OData/ODataSamples/issues/29#issuecomment-138274365","issue_url":"https://api.github.com/repos/OData/ODataSamples/issues/29","id":138274365,"user":{"login":"dhiraj","id":43901,"avatar_url":"https://avatars.githubusercontent.com/u/43901?v=3","gravatar_id":"","url":"https://api.github.com/users/dhiraj","html_url":"https://github.com/dhiraj","followers_url":"https://api.github.com/users/dhiraj/followers","following_url":"https://api.github.com/users/dhiraj/following{/other_user}","gists_url":"https://api.github.com/users/dhiraj/gists{/gist_id}","starred_url":"https://api.github.com/users/dhiraj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhiraj/subscriptions","organizations_url":"https://api.github.com/users/dhiraj/orgs","repos_url":"https://api.github.com/users/dhiraj/repos","events_url":"https://api.github.com/users/dhiraj/events{/privacy}","received_events_url":"https://api.github.com/users/dhiraj/received_events","type":"User","site_admin":false},"created_at":"2015-09-07T11:24:45Z","updated_at":"2015-09-07T11:24:45Z","body":"I spoke too soon, the server does *not* reply to the OPTIONS preflight approval request fired from the browser and the workaround does not actually work. :("}}