cazaimi
cazaimi

Reputation: 193

How do I disable the Sails v0.12 default CORS hook?

The sails.js(SailsJs CORS) website says that the Sails CORS hook is disabled by default, but I am currently working with a code base, where it seems to be enabled. I want to disable the same but I cannot find an answer on Stack Overflow, as well as on other sites to this. I also researched the Sails page to begin with, but with no luck.

Upvotes: 1

Views: 108

Answers (1)

cazaimi
cazaimi

Reputation: 193

The solution to this is as follows:

  1. Navigate to app_home_dir/.sailssrc
  2. You will find this JSON object there there:

    {
      "generators": {
      "modules": {}
      },
      "hooks": {
        "blueprints": false,
        "views": false,
        "sockets": false,
        "pubsub": false,
        "i18n": false,
        "cors": true
      }
    }
    
  3. Modify the cors property and set it to false.

This will disable the default Sails CORS hook.

Upvotes: 1

Related Questions