Skip to content

Access-control-allow-origin. Bug or....? #1251

@gjabelAmbitas

Description

@gjabelAmbitas

Have serve-api app and frontend app.

I set access-control-allow-origin on server - development / localhost:3002.

Also i have set app.register(require('fastify-cors'), { origin:true, });

But if i make request from development frontend site with fetch api (localhost on other port 3001)
with post method, chrome says:

Access to fetch at 'http://localhost:3002/login' from origin 'http://localhost:3001' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

But if i make GET request, it works..
Some advice how to solve this?
Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionGeneral question about the project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions