Skip to content

Multiple ‘Access-Control-Allow-Origin’ headers are being sent #773

@infinitiayush

Description

@infinitiayush

Initial checklist

  • I understand this is a bug report and questions should be posted in the Community Forum
  • I searched issues and couldn’t find anything (or linked relevant results below)

Steps to reproduce

I am implementing file upload functionality using tus and this is a basic tus server setup code

const tusServer: Server = new Server({
    path: '/app/upload/media',
    datastore: new FileStore({
        directory: imagesPath,
        configstore: config
    }),
    allowedOrigins: [],
    exposedHeaders: [''],
    allowedHeaders: [''],
    respectForwardedHeaders: true,
    namingFunction: async (req: Request, metadata?: Record<string, string | null>): Promise<string> => {
        if (metadata?.filename) return metadata?.filename;
        return "";
    },

The issue is that even thought I have set allowedOrigins: , it is still sending header “*” in response. which is causing CORS error on the FE. My BE framework also sends a Access-Control-Allow-Origin which causes the issue. Can tus ignore the Access-Control-Allow-Origin header all together if I have provided an empty list?

This is what I got on FE,

Image

Expected behavior

There should be an option to override the headers or remove them all together

Actual behavior

Tus is managing the headers all by itself and cannot be overriden.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions