-
Notifications
You must be signed in to change notification settings - Fork 676
Description
I've got an express app which returns some CORS headers. For some reason the headers get broken when the app is proxied through this lib on AWS Lambda.
Real express headers:
HTTP/1.1 200 OK
X-Powered-By: Express
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET,HEAD,PUT,PATCH,POST,DELETE
Vary: Access-Control-Request-Headers
Access-Control-Expose-Headers: Origin,X-Requested-With,Content-Type,Accept,RestrictingPassword
Date: Fri, 16 Jun 2017 11:41:48 GMT
Connection: keep-alive
Content-Length: 0
Headers I get from lambda:
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 0
Connection: keep-alive
Date: Fri, 16 Jun 2017 11:38:55 GMT
x-amzn-RequestId: 612405ba-5288-11e7-bc6e-e92a68da5155
access-control-allow-origin: https://example.com
x-amzn-Remapped-content-length: 0
x-amzn-Remapped-connection: close
vary: Origin, Access-Control-Request-Headers
access-control-allow-methods: GET,HEAD,PUT,PATCH,POST,DELETE
x-powered-by: Express
access-control-expose-headers: Origin,X-Requested-With,Content-Type,Accept,RestrictingPassword
X-Amzn-Trace-Id: sampled=0;root=1-5943c34f-44ea4b69896397eb4508c44f
x-amzn-Remapped-date: Fri, 16 Jun 2017 11:38:55 GMT
access-control-allow-credentials: true
As a result browsers do not recognise the CORS headers and nothing works.
I bet the problem is here https://github.com/awslabs/aws-serverless-express/blob/master/index.js#L73