{"action":"created","issue":{"url":"https://api.github.com/repos/CachetHQ/Cachet/issues/2947","repository_url":"https://api.github.com/repos/CachetHQ/Cachet","labels_url":"https://api.github.com/repos/CachetHQ/Cachet/issues/2947/labels{/name}","comments_url":"https://api.github.com/repos/CachetHQ/Cachet/issues/2947/comments","events_url":"https://api.github.com/repos/CachetHQ/Cachet/issues/2947/events","html_url":"https://github.com/CachetHQ/Cachet/issues/2947","id":306267503,"number":2947,"title":"No 'Access-Control-Allow-Origin' Header is present","user":{"login":"BaileyJM02","id":19824075,"avatar_url":"https://avatars2.githubusercontent.com/u/19824075?v=4","gravatar_id":"","url":"https://api.github.com/users/BaileyJM02","html_url":"https://github.com/BaileyJM02","followers_url":"https://api.github.com/users/BaileyJM02/followers","following_url":"https://api.github.com/users/BaileyJM02/following{/other_user}","gists_url":"https://api.github.com/users/BaileyJM02/gists{/gist_id}","starred_url":"https://api.github.com/users/BaileyJM02/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BaileyJM02/subscriptions","organizations_url":"https://api.github.com/users/BaileyJM02/orgs","repos_url":"https://api.github.com/users/BaileyJM02/repos","events_url":"https://api.github.com/users/BaileyJM02/events{/privacy}","received_events_url":"https://api.github.com/users/BaileyJM02/received_events","type":"User","site_admin":false},"labels":[{"id":865973162,"url":"https://api.github.com/repos/CachetHQ/Cachet/labels/triage","name":"triage","color":"ededed","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-03-18T18:32:13Z","updated_at":"2018-03-22T16:22:29Z","closed_at":null,"author_association":"NONE","body":"I have the following code:\r\n```JS\r\nvar data = JSON.stringify({\r\n  \"value\": 2 \r\n});\r\n\r\nvar xhr = new XMLHttpRequest();\r\nxhr.withCredentials = false; // Also tired with true\r\n\r\nxhr.addEventListener(\"readystatechange\", function () {\r\n  if (this.readyState === this.DONE) {\r\n    console.log(this.responseText);\r\n  }\r\n});\r\n\r\n\r\n\r\nxhr.open(\"POST\",\r\n  \"http://status.bailey.guru/api/v1/metrics/1/points\"\r\n);\r\n\r\nxhr.setRequestHeader(\"Content-Type\", \"application/json\");\r\nxhr.setRequestHeader(\"X-Cachet-Token\", \"YrJiZCSAPeCD9ZlVQLAx\");\r\n\r\nxhr.send(data);\r\n```\r\n\r\nI'm trying to add a point to one of my metrics however I am returned with the following error:\r\n```\r\nFailed to load http://status.bailey.guru/api/v1/metrics/1/points: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://vps.bailey.guru' is therefore not allowed access.\r\n```\r\nI think this is a bug related to #2473 as that is the error I got before adding `xhr.setRequestHeader(\"Content-Type\", \"application/json\");`.\r\n\r\nI've tried for the last 3-4 hours to fix it but to no eval. Can anyone help? "},"comment":{"url":"https://api.github.com/repos/CachetHQ/Cachet/issues/comments/375367733","html_url":"https://github.com/CachetHQ/Cachet/issues/2947#issuecomment-375367733","issue_url":"https://api.github.com/repos/CachetHQ/Cachet/issues/2947","id":375367733,"user":{"login":"uxen-ab","id":25496727,"avatar_url":"https://avatars2.githubusercontent.com/u/25496727?v=4","gravatar_id":"","url":"https://api.github.com/users/uxen-ab","html_url":"https://github.com/uxen-ab","followers_url":"https://api.github.com/users/uxen-ab/followers","following_url":"https://api.github.com/users/uxen-ab/following{/other_user}","gists_url":"https://api.github.com/users/uxen-ab/gists{/gist_id}","starred_url":"https://api.github.com/users/uxen-ab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uxen-ab/subscriptions","organizations_url":"https://api.github.com/users/uxen-ab/orgs","repos_url":"https://api.github.com/users/uxen-ab/repos","events_url":"https://api.github.com/users/uxen-ab/events{/privacy}","received_events_url":"https://api.github.com/users/uxen-ab/received_events","type":"User","site_admin":false},"created_at":"2018-03-22T16:22:29Z","updated_at":"2018-03-22T16:22:29Z","author_association":"CONTRIBUTOR","body":"Have you tried to add a header 'Origin' in your request?\r\nOtherwise come on Slack we'll be glad to help you!"}}
{"actor":{"display_login":"uxen-ab"}}