swagger-express-middleware icon indicating copy to clipboard operation
swagger-express-middleware copied to clipboard

Responds to all OPTIONS requests as CORS preflights, even if they are not CORS requests

Open JamesMGreene opened this issue 8 years ago • 2 comments

When enabling the CORS middleware, it inappropriately responds to all HTTP OPTIONS requests as if they were a CORS preflight request -- not just for CORS requests.

Per the CORS spec's "Resource Processing Model" section, requests without the Origin header present are not CORS requests.

This prevents us from responding to normal OPTIONS requests.

NOTE: This bug could possibly be worked around by registering our OPTIONS route handler middleware ahead of the Swagger middleware but I haven't tested that.

JamesMGreene avatar Mar 16 '16 16:03 JamesMGreene

Good point! Thanks for the link to the W3C spec too, that's very helpful.

This is definitely a bug and will be fixed.

JamesMessinger avatar Mar 16 '16 16:03 JamesMessinger

guys, what is the status of that issue?

dimitriy-k avatar Sep 25 '19 12:09 dimitriy-k