Can I disable cors ?
Closed this issue · 2 comments
ar90n commented
From v2.1.0, the behavior of cors as argument was changed.
In the past version, When I set cors to false, I could disable this function.
But in current version, When I set cors to null(or false), an error occured and displayed the follwoing messages.
TypeError: Cannot read property 'CORSRule' of undefined
at /Users/argon/workspace/managed/s3rver/lib/cors.js:48:42
at Layer.handle [as handle_request] (/Users/argon/workspace/managed/s3rver/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/Users/argon/workspace/managed/s3rver/node_modules/express/lib/router/index.js:317:13)
at /Users/argon/workspace/managed/s3rver/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/Users/argon/workspace/managed/s3rver/node_modules/express/lib/router/index.js:335:12)
at next (/Users/argon/workspace/managed/s3rver/node_modules/express/lib/router/index.js:275:10)
at /Users/argon/workspace/managed/s3rver/lib/app.js:45:5
at Layer.handle [as handle_request] (/Users/argon/workspace/managed/s3rver/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/Users/argon/workspace/managed/s3rver/node_modules/express/lib/router/index.js:317:13)
at /Users/argon/workspace/managed/s3rver/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/Users/argon/workspace/managed/s3rver/node_modules/express/lib/router/index.js:335:12)
at next (/Users/argon/workspace/managed/s3rver/node_modules/express/lib/router/index.js:275:10)
at logger (/Users/argon/workspace/managed/s3rver/node_modules/morgan/index.js:144:5)
at Layer.handle [as handle_request] (/Users/argon/workspace/managed/s3rver/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/Users/argon/workspace/managed/s3rver/node_modules/express/lib/router/index.js:317:13)
at /Users/argon/workspace/managed/s3rver/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/Users/argon/workspace/managed/s3rver/node_modules/express/lib/router/index.js:335:12)
at next (/Users/argon/workspace/managed/s3rver/node_modules/express/lib/router/index.js:275:10)
at expressInit (/Users/argon/workspace/managed/s3rver/node_modules/express/lib/middleware/init.js:40:5)
at Layer.handle [as handle_request] (/Users/argon/workspace/managed/s3rver/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/Users/argon/workspace/managed/s3rver/node_modules/express/lib/router/index.js:317:13)
at /Users/argon/workspace/managed/s3rver/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/Users/argon/workspace/managed/s3rver/node_modules/express/lib/router/index.js:335:12)
at next (/Users/argon/workspace/managed/s3rver/node_modules/express/lib/router/index.js:275:10)
at query (/Users/argon/workspace/managed/s3rver/node_modules/express/lib/middleware/query.js:45:5)
at Layer.handle [as handle_request] (/Users/argon/workspace/managed/s3rver/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/Users/argon/workspace/managed/s3rver/node_modules/express/lib/router/index.js:317:13)
at /Users/argon/workspace/managed/s3rver/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/Users/argon/workspace/managed/s3rver/node_modules/express/lib/router/index.js:335:12)
at next (/Users/argon/workspace/managed/s3rver/node_modules/express/lib/router/index.js:275:10)
at Function.handle (/Users/argon/workspace/managed/s3rver/node_modules/express/lib/router/index.js:174:3)
at Function.handle (/Users/argon/workspace/managed/s3rver/node_modules/express/lib/application.js:174:10)
at Server.app (/Users/argon/workspace/managed/s3rver/node_modules/express/lib/express.js:39:9)
at emitTwo (events.js:125:13)
at Server.emit (events.js:213:7)
at parserOnIncoming (_http_server.js:602:12)
at HTTPParser.parserOnHeadersComplete (_http_common.js:116:23)
It seems that CORSConfiguration in cors() @ cors.js is not initialized.
Because the config as argument of cors is evaluated to false.
What should I do ?
kherock commented
Yeah, looks like I managed to break this. I've created a PR at #150 I'll merge shortly and hopefully we can cut a release soon after, but in the meantime you'll probably have to stick to 2.0 or install the branch at
$ npm install jamhall/s3rver#fix-cors-disabled
ar90n commented
@specialkk Thanks for your great efforts. I will try to use it !