Comments (4)
Hi @alshamma, I'll look into it. @vmadman what do you think?
@alshamma Can you test each header separately to see which one is blocking?
from serverless-offline.
@dherault The error message from Chrome indicates that the "Origin" header is not accepted. But, Firefox sends Origin. Here is the list of headers that Firefox sends:
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.5
Accept: */*
Authorization: xxx
Connection: keep-alive
DNT: 1
Host: localhost.editinps.com:3000
Origin: https://localhost.editinps.com:3001
Referer: https://localhost.editinps.com:3001/dashboard
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:46.0) Gecko/20100101 Firefox/46.0
And the response in Firefox:
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: https://localhost.editinps.com:3001
Cache-Control: no-cache
Connection: keep-alive
Content-Encoding: gzip
Content-Type: application/json; charset=utf-8
Date: Thu, 02 Jun 2016 15:29:35 GMT
Transfer-Encoding: chunked
Vary: origin,accept-encoding
access-control-expose-headers: WWW-Authenticate,Server-Authorization
For Chrome, I can only see the headers sent on OPTIONS, which succeeds. It is the GET that fails:
Accept-Encoding: gzip, deflate, sdch, br
Accept-Language: en-US,en;q=0.8
Accept: */*
Access-Control-Request-Headers: accept, authorization
Access-Control-Request-Method: GET
Cache-Control: no-cache
Connection: keep-alive
DNT: 1
Host: localhost.editinps.com:3000
Origin: https://localhost.editinps.com:3001
Pragma: no-cache
Referer: https://localhost.editinps.com:3001/dashboard
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.63 Safari/537.36
For some reason, I can't see the OPTIONS for this particular call in Firefox, but I do see it in Chrome.
Do you have experience with Charles Proxy? I've set a breakpoint for the GET call to https://localhost.editinps.com:3000. It hits the breakpoint on OPTIONS and GET when I execute from Firefox but nothing at all from Chrome.
from serverless-offline.
I found what appears to be the problem. Chrome sends the "Referer" header in OPTIONS and Firefox does not. As a result, offline does not send the CORS Access-Control-xxx headers in the OPTIONS response to Chrome.
The workaround is to add referer to --corsAllowHeaders.
from serverless-offline.
Yikes, it was working while Charles Proxy was running, but stopped working after reboot. Debugging some more.
from serverless-offline.
Related Issues (20)
- Support for Python 3.10 (and 3.11) HOT 5
- Add Ruby 3.2 runtime support HOT 3
- Unhandled exception in handler 'index'. HOT 1
- Bump serverless-offline version to 12.0.5 HOT 1
- How to run lambda integration mode in serverless locally
- App hangs when launching in debug mode on Webstorm HOT 2
- ALB event doesn't reflect custom headers specified in handler.ts HOT 2
- dotnet6 future donet7 support HOT 1
- clientCert property is undefined when client certificates are used
- Extend support for ALB event paths
- Enable mixed API usage with same routes
- SLS_ACCOUNT_ID identity override for schedule events
- I think you removed Node 16 support too soon HOT 1
- How to set timeout properly HOT 1
- Add support for nodejs20.x runtime
- Stripping trailing slashes breaks django admin
- Inconsistency in `authorizer` Model When Using `serverless-offline` with AWS PowerTools for Lambda HOT 2
- How to clear cache on cognito HOT 1
- x-api-key no longer being provided HOT 4
- Lambci docker images are deprecated and no more maintained. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from serverless-offline.