npm.io
0.1.1-alpha.64 • Published 6 years ago

smooth-plugin-headers

Licence
MIT
Version
0.1.1-alpha.64
Deps
1
Size
7 kB
Vulns
0
Weekly
0
Stars
26

smooth-plugin-headers

Automatically adds response headers.

Usage

Edit smooth.config.js:

// smooth.config.js
module.exports = {
  plugins: [
    {
      resolve: 'smooth-plugin-headers',
      options: {
        // Add any options here
      },
    }
  ],
}

Options

headers

Set headers for all maching pages, ReactRouter format can be used (see path-to-regexp).
Headers entries are merged on differents rules but are overwritten on sames, below rules overwrite above ones.

// smooth.config.js
module.exports = {
  plugins: [
    {
      resolve: 'smooth-plugin-headers',
      options: {
        headers: {
          '(.*)': ['Cache-Control: public, max-age=900'],
          '(*.ico)': ['Cache-Control: public, max-age=2592000'],
          '/graphql': ['Cache-Control: no-cache'],
        },
      },
    }
  ],
}