Open AnalogJ opened 8 years ago
@AnalogJ Just tried this, but I'm afraid I was not able to reproduce the issue.
Can you provide your full s-function.json
and embedded template(s) please?
I had this problem too, my custom header is not being set on the response of OPTIONS call. I had to go to API Gateway and add it manually:
sls version 0.5.5
s-project.json:
{
"name": "api-stationfy-sls",
"custom": {
"cors": {
"allowOrigin": "*",
"allowHeaders": [
"Content-Type",
"X-Amz-Date",
"Authorization",
"X-Api-Key",
"Preferred-Language"
]
}
},
"plugins": [
"serverless-cors-plugin"
]
}
@rodrigoreis22 did you deploy your endpoints with the -a
flag? Otherwise, the preflight (OPTIONS
) endpoints will not be deployed.
@joostfarla no i didn't.. what's the -a flag? I'll try it.
@rodrigoreis22 -a
/ --all
is the flag to deploy all your endpoints at the same time. Only then, your preflight (OPTIONS
) endpoints will be deployed.
@joostfarla thanks.
I'm trying to send a custom header to my Serverless endpoint using AngularJS and JQuery, and whenever I do I get a 403 error during the OPTIONS preflight check.
My
s-function.json
has:My
s-templates.json
file has:I've tested it with a simple JQuery request:
If I comment out the
beforeSend
block, the request completes successfully.