No 'Access-Control-Allow-Origin' when sending a stringified Object in request parameter
Hello,
This error occurs on production after deploying my application via serverless. My express server is using the cors library ( app.use(cors()) at the beginning of my express application ). my http setting of my serverless.yml file are:
functions:
webBackend:
handler: handler.index
events:
- http: ANY {proxy+}
- http: ANY /
normally sending GET requests with query parameters works fine e.g.
[my_items_route]?query=stuhlhusse
But when I send a GET query with the following request parameter : [another_get_route]?filters={%225d9b60f5d7610d408d8b751d%22:[%225d9b60f5d7610d408d8b751e%22]}
I get the following error : Failed to load [my_get_route]?filters={%225d9b60f5d7610d408d8b751d%22:[%225d9b60f5d7610d408d8b751e%22]}: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin'
sending the request without the query parameters on the same route is also working normally.
I can't figure this out
versions aws-serverless-express : 3.3.6 nodejs : 8.11
Do you have route handling for OPTIONS? The cors package only works on defined routes. If youre pre-flighting, you need to have the OPTIONS action for the route defined
I don't have setup any settings for any OPTIONS actions. There are a lot of other pre-flight requests which doesn't get blocked, just this one ...
The requests that does not work contains a % character and the working request does not. Issue #219 may be playing a factor in why you are erroring