Code Monkey home page Code Monkey logo

Comments (14)

sstern6 avatar sstern6 commented on July 20, 2024 1

Had the same issue as @nicooga, removed [origin: "localhost: 4000"] from plug CORSPlug and I was able to get the response back without The 'Access-Control-Allow-Origin' header contains the invalid value 'null'.

from cors_plug.

mschae avatar mschae commented on July 20, 2024

@nicooga Hard to track down from the information provided. Maybe provide the output of this:

curl -svo /dev/null -XOPTION https://9e68e012.ngrok.io/api/expenditures
curl -svo /dev/null https://9e68e012.ngrok.io/api/expenditures

from cors_plug.

nicooga avatar nicooga commented on July 20, 2024

I choosed to just plug CORSPlug without options for now. If I find issues using a named origin instead of a wildcard later I'll reopen the issue. Thanks for the response!

from cors_plug.

linjunpop avatar linjunpop commented on July 20, 2024

I found that the client attached the Origin header with content which is in the config list, or the Access-Control-Allow-Origin will be null, according to this:

if req_origin =~ regex, do: req_origin, else: "null"

from cors_plug.

mschae avatar mschae commented on July 20, 2024

Sorry for the radio silence, swamped lately... Will check this out shortly. PRs are always welcome tho :)

from cors_plug.

sstern6 avatar sstern6 commented on July 20, 2024

Will take a look and see if I can make any changes. Will let you know if I have any questions

Thanks

from cors_plug.

VJ-OK avatar VJ-OK commented on July 20, 2024

Not working for me. :(

from cors_plug.

jschneider1207 avatar jschneider1207 commented on July 20, 2024

This was happening to me because the requests coming into my server had the origin header with a capital "O", and this is specifically looking for origin (lowercase).

from cors_plug.

oskarrough avatar oskarrough commented on July 20, 2024

Hi, I'm also seeing null as the value. I've set

plug CORSPlug, origin: ["https://example.com", "https://another.com"]
plug MyApp.Router

… but If I do

plug CORSPlug
plug MyApp.Router

the value is * as per the default options.

So something IS working and I assume the error is in my configuration. Any help would be appreciated.

from cors_plug.

linjunpop avatar linjunpop commented on July 20, 2024

@oskarrough Did you check what's the value of the request Origin header? As I mentioned in #18 (comment)

from cors_plug.

oskarrough avatar oskarrough commented on July 20, 2024

@linjunpop ooooh, thank you. Checking the value I discovered a typo in my domain…

from cors_plug.

linjunpop avatar linjunpop commented on July 20, 2024

@mschae IMO this behaviour is confusing, is that expected?

from cors_plug.

mschae avatar mschae commented on July 20, 2024

@linjunpop I don't understand the behaviour you are describing. Please elaborate following standard issue reporting guidelines: What behaviour do you expect. What behaviour are you seeing instead? Why do you believe this is wrong?

from cors_plug.

linjunpop avatar linjunpop commented on July 20, 2024

Oh, my mistake, https://www.w3.org/TR/cors/#access-control-allow-origin-response-header describe the null is valid.

from cors_plug.

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.