Skip to content

CORS error after upgrading @fastify-cors 10.1.0 -> 11.0.1 #370

@nam-qoco

Description

@nam-qoco

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Fastify version

11.0.1

Plugin version

No response

Node.js version

22.x

Operating system

macOS

Operating system version (i.e. 20.04, 11.3, 10)

Sonoma 14.6

Description

I am using this code for registering CORS to Fastify server:

import cors from '@fastify/cors';

const registerCors = (server: FastifyInstance): void => {
    const corsSettings = { origin: '*' };
    server.register(cors, corsSettings);
  };

This code worked well with @fastify/cors v10.1.0.

But after upgrading to the latest version 11.0.1:

  • GET and POST requests work normally;
  • PUT requests failed with CORS Error.

Image
Image

Link to code that reproduces the bug

1

Expected Behavior

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions