Giter Site home page Giter Site logo

Comments (12)

mcollina avatar mcollina commented on May 18, 2024

Would you like to send a Pull Request to address this issue? Remember to add unit tests.

from fastify-cors.

zekth avatar zekth commented on May 18, 2024

Could you please specify the version of fastify-cors you're using?
Also please provide the request headers.

I cannot reproduce using:

fastify 3.15.0
fastify-cors 5.2.0

from fastify-cors.

zyrouge avatar zyrouge commented on May 18, 2024

Could you please specify the version of fastify-cors you're using?
Also please provide the request headers.

I cannot reproduce using:

fastify 3.15.0
fastify-cors 5.2.0

It occurred while using v5.2.0, I'll try once again and try to identify the issue! :)

from fastify-cors.

Fdawgs avatar Fdawgs commented on May 18, 2024

@zyrouge do you have a public repo where this is occurring that you are able to share?

from fastify-cors.

zyrouge avatar zyrouge commented on May 18, 2024

@zyrouge do you have a public repo where this is occurring that you are able to share?

Wish i could but its private :(

from fastify-cors.

zyrouge avatar zyrouge commented on May 18, 2024

I reproduced it, check https://github.com/zyrouge/fastify-cors/tree/header-false for the code.
image

from fastify-cors.

zyrouge avatar zyrouge commented on May 18, 2024

Assuming that the false value comes from

return isRequestOriginAllowed(reqOrigin, originOption) ? reqOrigin : false
and browsers can't understand the false value and throws up a warning. According to https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin null value can be used but is not preferred, as a response with no header will be the solution?

from fastify-cors.

zekth avatar zekth commented on May 18, 2024

false value means that the request is not allowed. Also you're not sharing the request headers, there is no way to reproduce it properly.

from fastify-cors.

zyrouge avatar zyrouge commented on May 18, 2024

false value means that the request is not allowed. Also you're not sharing the request headers, there is no way to reproduce it properly.

I did some research and found that the cors header should only have a value of * or an origin. I don't think false is the appropriate value to be set. It still does the job but it would be nice if there is a solution to get rid of warnings displayed in the browser when using it. I'll make sure to share the request headers. :)

from fastify-cors.

zekth avatar zekth commented on May 18, 2024

This need to be adressed in another issue.

Is your issue solved?

from fastify-cors.

zyrouge avatar zyrouge commented on May 18, 2024

This need to be adressed in another issue.

Is your issue solved?

Fix for #127 would solve this.

from fastify-cors.

mcollina avatar mcollina commented on May 18, 2024

Fixed in v6.0.0

from fastify-cors.

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.