{"action":"created","issue":{"url":"https://api.github.com/repos/jaws-framework/JAWS/issues/222","labels_url":"https://api.github.com/repos/jaws-framework/JAWS/issues/222/labels{/name}","comments_url":"https://api.github.com/repos/jaws-framework/JAWS/issues/222/comments","events_url":"https://api.github.com/repos/jaws-framework/JAWS/issues/222/events","html_url":"https://github.com/jaws-framework/JAWS/issues/222","id":111106560,"number":222,"title":"Question: angular $http.post to API Gateway getting 403","user":{"login":"jodagm","id":1626913,"avatar_url":"https://avatars.githubusercontent.com/u/1626913?v=3","gravatar_id":"","url":"https://api.github.com/users/jodagm","html_url":"https://github.com/jodagm","followers_url":"https://api.github.com/users/jodagm/followers","following_url":"https://api.github.com/users/jodagm/following{/other_user}","gists_url":"https://api.github.com/users/jodagm/gists{/gist_id}","starred_url":"https://api.github.com/users/jodagm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jodagm/subscriptions","organizations_url":"https://api.github.com/users/jodagm/orgs","repos_url":"https://api.github.com/users/jodagm/repos","events_url":"https://api.github.com/users/jodagm/events{/privacy}","received_events_url":"https://api.github.com/users/jodagm/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-10-13T05:19:59Z","updated_at":"2015-10-13T13:41:35Z","closed_at":null,"body":"Hi,\r\n\r\nI am able to call API GW successfully from postman, however calling it from angular $http.post leads to error 403.\r\n\r\nIt might be related to CORS.\r\nbased on #133 I setup the endpoint as follows:\r\n\r\n```\r\n\"apiGateway\": {\r\n    \"deploy\": false,\r\n    \"cloudFormation\": {\r\n      \"Type\": \"AWS\",\r\n      \"Path\": \"login\",\r\n      \"Method\": \"POST\",\r\n      \"AuthorizationType\": \"none\",\r\n      \"ApiKeyRequired\": false,\r\n      \"RequestTemplates\": {},\r\n      \"RequestParameters\": {},\r\n      \"Responses\": {\r\n        \"400\": {\r\n          \"statusCode\": \"400\"\r\n        },\r\n        \"default\": {\r\n          \"statusCode\": \"200\",\r\n          \"responseParameters\": {\r\n            \"method.response.header.Access-Control-Allow-Origin\": \"'*'\"\r\n          },\r\n          \"responseTemplates\": {\r\n            \"application/json\": \"\"\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n```\r\n\r\n\r\nAny help is greatly appreciated\r\nJonathan"},"comment":{"url":"https://api.github.com/repos/jaws-framework/JAWS/issues/comments/147717287","html_url":"https://github.com/jaws-framework/JAWS/issues/222#issuecomment-147717287","issue_url":"https://api.github.com/repos/jaws-framework/JAWS/issues/222","id":147717287,"user":{"login":"OneMuppet","id":4235764,"avatar_url":"https://avatars.githubusercontent.com/u/4235764?v=3","gravatar_id":"","url":"https://api.github.com/users/OneMuppet","html_url":"https://github.com/OneMuppet","followers_url":"https://api.github.com/users/OneMuppet/followers","following_url":"https://api.github.com/users/OneMuppet/following{/other_user}","gists_url":"https://api.github.com/users/OneMuppet/gists{/gist_id}","starred_url":"https://api.github.com/users/OneMuppet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OneMuppet/subscriptions","organizations_url":"https://api.github.com/users/OneMuppet/orgs","repos_url":"https://api.github.com/users/OneMuppet/repos","events_url":"https://api.github.com/users/OneMuppet/events{/privacy}","received_events_url":"https://api.github.com/users/OneMuppet/received_events","type":"User","site_admin":false},"created_at":"2015-10-13T13:41:35Z","updated_at":"2015-10-13T13:41:35Z","body":"@jodagm you are right, I get the same error on when using POST. What I did as a \"workaround\" for now was to, deploy my Lambda and API Gateway endpoint. Then I opened the awsm.json and changed the method from POST to OPTIONS:\r\n´´´javascript\r\n\"apiGateway\": {\r\n    \"deploy\": false,\r\n    \"cloudFormation\": {\r\n      \"Type\": \"AWS\",\r\n      \"Path\": \"greetings/hellopost\",\r\n      \"Method\": \"OPTIONS\",\r\n      \"AuthorizationType\": \"none\",\r\n      \"ApiKeyRequired\": false,\r\n      \"RequestTemplates\": {},\r\n      \"RequestParameters\": {},\r\n      \"Responses\": {\r\n        \"400\": {\r\n          \"statusCode\": \"400\"\r\n        },\r\n        \"default\": {\r\n          \"statusCode\": \"200\",\r\n          \"responseParameters\": {\r\n            \"method.response.header.Access-Control-Allow-Headers\": \"'Content-Type,X-Amz-Date,Authorization'\",\r\n            \"method.response.header.Access-Control-Allow-Methods\": \"'POST, OPTIONS'\",\r\n            \"method.response.header.Access-Control-Allow-Origin\": \"'*'\"\r\n          },\r\n          \"responseModels\": {},\r\n          \"responseTemplates\": {\r\n            \"application/json\": \"\"\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n´´´\r\nand deployed the API Gateway Endpoint again, that way I get both methods with the same setup:\r\n![image](https://cloud.githubusercontent.com/assets/4235764/10456199/47a266f0-71c0-11e5-818e-fa7123ab380c.png)\r\n\r\nThis will require you to remember to deploy a OPTIONS endpoint as well as a \"normal\" endpoint each time you add a new method or what to change something in how your endpoint works. We all know that everything that we have to remember, we are sure to forget so this is not a long term solution but more of an input to the discussion. \r\n\r\n@ac360 Is it possible to deploy multiple methods for one API Gateway endpoint?"}}