View our GitHub

Please visit sails-docs on GitHub to view documentation on your mobile device.

Edit Page


This file is conventionally used for configuring the underlying HTTP server (the sails.config.http object.)

This includes all HTTP-specific middleware, including the serving/caching of flat files.

 * HTTP Server Settings
 * (sails.config.http)
 * Configuration for the underlying HTTP server in Sails.
 * Only applies to HTTP requests (not WebSockets)
 * For more information on configuration, check out:

module.exports.http = {

  middleware: {

    // The order in which middleware should be run for HTTP request.
    // (the Sails router is invoked by the "router" middleware below.)
    order: [

    // The body parser that will handle incoming multipart HTTP requests.
    // By default as of v0.10, Sails uses [skipper](
    // See for other options.
    // bodyParser: require('skipper')


  // The number of seconds to cache flat files on disk being served by
  // Express static middleware (by default, these files are in `.tmp/public`)
  // The HTTP static cache is only active in a 'production' environment,
  // since that's the only time Express will cache flat-files.
  cache: 31557600000

Is something missing?

If you notice something we've missed or could be improved on, please follow this link and submit a pull request to the sails-docs repo. Once we merge it, the changes will be immediately reflected on the website.