{"action":"created","issue":{"url":"https://api.github.com/repos/axios/axios/issues/569","repository_url":"https://api.github.com/repos/axios/axios","labels_url":"https://api.github.com/repos/axios/axios/issues/569/labels{/name}","comments_url":"https://api.github.com/repos/axios/axios/issues/569/comments","events_url":"https://api.github.com/repos/axios/axios/issues/569/events","html_url":"https://github.com/axios/axios/issues/569","id":193281057,"node_id":"MDU6SXNzdWUxOTMyODEwNTc=","number":569,"title":"CORS error No 'Access-Control-Allow-Origin' header is present on the requested resource","user":{"login":"andylaci","id":7139923,"node_id":"MDQ6VXNlcjcxMzk5MjM=","avatar_url":"https://avatars0.githubusercontent.com/u/7139923?v=4","gravatar_id":"","url":"https://api.github.com/users/andylaci","html_url":"https://github.com/andylaci","followers_url":"https://api.github.com/users/andylaci/followers","following_url":"https://api.github.com/users/andylaci/following{/other_user}","gists_url":"https://api.github.com/users/andylaci/gists{/gist_id}","starred_url":"https://api.github.com/users/andylaci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andylaci/subscriptions","organizations_url":"https://api.github.com/users/andylaci/orgs","repos_url":"https://api.github.com/users/andylaci/repos","events_url":"https://api.github.com/users/andylaci/events{/privacy}","received_events_url":"https://api.github.com/users/andylaci/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":25,"created_at":"2016-12-03T11:13:43Z","updated_at":"2018-10-01T10:59:49Z","closed_at":"2016-12-04T06:41:28Z","author_association":"NONE","body":"Hello, this is my request:\r\n\r\n`\r\naxios({\r\n      method: 'POST',\r\n      url: `${SERVER_ADDRESS}/api/v1/manager/restaurant/${restaurantName}/payment-methods`,\r\n      crossDomain: true,\r\n      data: {\r\n        payment_methods: checkedPayments\r\n      },\r\n    })\r\n      .then(() => {\r\n        dispatch(loadPayments(restaurantName));\r\n      }).catch((error) => {\r\n      console.log(error);\r\n        dispatch(paymentsError());\r\n      });\r\n`\r\n\r\nthe server is laravel 5, it is responding with:\r\n\r\n`XMLHttpRequest cannot load http://localhost:8000/api/v1/manager/restaurant/accusamus/payment-methods. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access.`\r\n\r\nServer headers are set with CORS middleware like this:\r\n\r\n        return $next($request)\r\n            ->header(\"Access-Control-Expose-Headers\", \"Access-Control-*\")\r\n            ->header(\"Access-Control-Allow-Headers\", \"Access-Control-*, Origin, X-Requested-With, Content-Type, Accept\")\r\n            ->header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS, HEAD')\r\n            ->header('Access-Control-Allow-Origin', '*')\r\n            ->header('Allow', 'GET, POST, PUT, DELETE, OPTIONS, HEAD');\r\n\r\nTheese are the response headers, which I get when I use postman:\r\n\r\nAccess-Control-Allow-Headers →Access-Control-*, Origin, X-Requested-With, Content-Type, Accept\r\nAccess-Control-Allow-Methods →GET, POST, PUT, DELETE, OPTIONS, HEAD\r\nAccess-Control-Allow-Origin →*\r\nAccess-Control-Expose-Headers →Access-Control-*\r\nAllow →GET, POST, PUT, DELETE, OPTIONS, HEAD\r\nCache-Control →no-cache\r\nConnection →close\r\nContent-Type →text/html; charset=UTF-8\r\nDate →Sat, 03 Dec 2016 10:33:04 GMT\r\nHost →localhost:8000\r\nX-Powered-By →PHP/7.0.13\r\nX-RateLimit-Limit →60\r\nX-RateLimit-Remaining →59\r\nphpdebugbar-id →0ff14bef1824f587d8f278c87ab52544\r\n\r\nAXIOS sends preflight which is:\r\n\r\nRequest URL:http://localhost:8000/api/v1/manager/restaurant/accusamus/payment-methods\r\nRequest Method:OPTIONS\r\nStatus Code:200 OK\r\nRemote Address:[::1]:8000\r\nResponse Headers\r\nview source\r\nAllow:GET,HEAD,POST\r\nCache-Control:no-cache\r\nConnection:close\r\nContent-Type:text/html; charset=UTF-8\r\nDate:Sat, 03 Dec 2016 10:25:27 GMT\r\nHost:localhost:8000\r\nX-Powered-By:PHP/7.0.13\r\n\r\nRequest Headers\r\nview source\r\nAccept:*/*\r\nAccept-Encoding:gzip, deflate, sdch, br\r\nAccept-Language:en-US,en;q=0.8\r\nAccess-Control-Request-Headers:content-type\r\nAccess-Control-Request-Method:POST\r\nConnection:keep-alive\r\nHost:localhost:8000\r\nOrigin:http://localhost:3000\r\nReferer:http://localhost:3000/restaurant-profile/payment\r\nUser-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36\r\n\r\nAm I doing something wrong? I can't figure it how to do this. Witch Chrome plugin CORS everything works fine, but this is not the way.\r\n\r\nPlease help, help is really appreciated, spent hours with this."},"comment":{"url":"https://api.github.com/repos/axios/axios/issues/comments/425867887","html_url":"https://github.com/axios/axios/issues/569#issuecomment-425867887","issue_url":"https://api.github.com/repos/axios/axios/issues/569","id":425867887,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNTg2Nzg4Nw==","user":{"login":"GraxMonzo","id":11737104,"node_id":"MDQ6VXNlcjExNzM3MTA0","avatar_url":"https://avatars2.githubusercontent.com/u/11737104?v=4","gravatar_id":"","url":"https://api.github.com/users/GraxMonzo","html_url":"https://github.com/GraxMonzo","followers_url":"https://api.github.com/users/GraxMonzo/followers","following_url":"https://api.github.com/users/GraxMonzo/following{/other_user}","gists_url":"https://api.github.com/users/GraxMonzo/gists{/gist_id}","starred_url":"https://api.github.com/users/GraxMonzo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GraxMonzo/subscriptions","organizations_url":"https://api.github.com/users/GraxMonzo/orgs","repos_url":"https://api.github.com/users/GraxMonzo/repos","events_url":"https://api.github.com/users/GraxMonzo/events{/privacy}","received_events_url":"https://api.github.com/users/GraxMonzo/received_events","type":"User","site_admin":false},"created_at":"2018-10-01T10:59:49Z","updated_at":"2018-10-01T10:59:49Z","author_association":"NONE","body":"My solution is\r\n`axios.get('https://cors-anywhere.herokuapp.com/' + yourUrl)`"}}
{"actor":{"display_login":"GraxMonzo"}}