0

With the newly available community version of Parse server (https://github.com/parse-community/parse-server) there does not seem to be a configuration option to disable the /files endpoints which allow for file upload and hosting. I would very much like to disable this feature, and Cloud Code server-side hooks are not a good option (not currently supported in parse-dashboard, among other problems). What's the best way to disable these endpoints?

oliakaoil
  • 1,615
  • 2
  • 15
  • 36

2 Answers2

0

Using a little middleware works for me. Add this to your parse app config:

{
  "middleware": "disableFilesMiddleware",
}

And then for your middleware module disableFilesMiddleware.js:

module.exports = function( req , res , next ){

  if( req.path.substring( 0 , 12 ) === '/parse/files' ) {
    res.status(400).send({ code: 119 , message: 'files endpoints are disabled' }); 
    return;
  }

  next();
};
oliakaoil
  • 1,615
  • 2
  • 15
  • 36
0

For anyone using Parse 5+, you can configure this in your Parse Server config to disabled all uploading:

fileUpload: {
  enableForPublic: false,
  enableForAnonymousUser: false,
  enableForAuthenticatedUser: false
}

You can read about it in the docs here

wouter
  • 21
  • 5