Didn't Return CORS from OPTIONS method
I'm calling a method POST that has a OPTIONS method together and cors from a OPTIONS method returns wrong.
That's my configuration on serverless.yml:
functions: load: handler: handler.main events: - http: path: /load method: POST cors: true - http: path: /load method: OPTIONS cors: true
Return:
Request URL:http://localhost:3000/load Request Method:OPTIONS Status Code:200 OK Remote Address:127.0.0.1:3000
Response Header access-control-allow-credentials:true access-control-allow-origin:null access-control-expose-headers:WWW-Authenticate,Server-Authorization cache-control:no-cache Connection:keep-alive content-encoding:gzip content-type:application/json; charset=utf-8 Date:Fri, 02 Sep 2016 14:47:32 GMT Transfer-Encoding:chunked vary:origin,accept-encoding
I'm making the request from a web page, because with postman works fine.
is it a bug?
Not certain. Can you explain further. You did a POST and it used OPTIONS verb instead?
When I call a POST method from a webPage, it is first calls a OPTIONS method to check CORS, and them calls the POST method.
Ok. I will check. The goal is to only invoke POST in that scenario, correct?
No, browser will send OPTIONS before a POST, so we have to treat correctly CORS on OPTIONS method.
@Bilal-S Hi Bilal, I see a lot of new issues but I don't have time to solve them all. You seem to be doing a pretty good job around them, do you need any kind of assistance?
@dherault I am pretty slammed this week. I have put aside some time next week to look at the issues and was hoping to also refactor some code. The RC1 release has breaking changes so I need to check that out as well.
@Bilal-S Yeah I'm slammed too... Thanks a lot, it's ok if you can't.
so we have to treat correctly CORS on OPTIONS method.
@Bilal-S Is it fixed? If not I'll do it. I feel the v1 comming :)
@dherault not fixed yet afaik. Would be cool if you could take a look.
Fixed in v3.3.3, thanks @mhodgson