Skip to content

should preflight request return 204 instead of 404 when origin not match? #65

@atian25

Description

@atian25

Background

If a browser sends an OPTIONS request, but origin it not match, now koajs/cors will return 404 status code, due to https://github.com/koajs/cors/blob/master/index.js#L60

then the browser will warn 404, some user will confuse if they need to register an OPTION router.

Discuss

should it return 204 here?

I don't find any clear description at SPEC:

https://www.w3.org/TR/cors 7.1.5 Cross-Origin Request with Preflight

and according to spec below, OPTIONS should never return 404.

and Express will return 204, https://github.com/expressjs/cors/blob/master/lib/index.js#L178

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