Giter Site home page Giter Site logo

Comments (4)

dherault avatar dherault commented on May 27, 2024

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.

alshamma avatar alshamma commented on May 27, 2024

@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.

alshamma avatar alshamma commented on May 27, 2024

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.

alshamma avatar alshamma commented on May 27, 2024

Yikes, it was working while Charles Proxy was running, but stopped working after reboot. Debugging some more.

from serverless-offline.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.