JSPM

@qonfucius/nuxt-headers

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q18280F
  • License MIT

Custom headers for nuxtJS

Package Exports

  • @qonfucius/nuxt-headers

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@qonfucius/nuxt-headers) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Custom Nuxt Headers

Installation

Add this library in dependencies, then add it to nuxtJS modules

npm install @qonfucius/nuxt-headers
// nuxt.config.js
export default {
  modules: [
    '@qonfucius/nuxt-headers',
  ],
};

Usage

With this module you will be able to add custom headers in many ways :

  • Via serverHeaders, it will add to every request, via server middleware, including serving assets, favicon... You can access to req in parameters.
  • Via nuxtHeaders, it will add to every page access, via middleware. You can access to context in parameters.
  • In vue scripts, you can add a key httpHeaders, with same behavior than nuxtHeaders, but specific for a page.

Priority

Lowest in list is prior

  • All headers in config key httpHeaders.serverHeaders are set
  • All headers in config key httpHeaders.nuxtHeaders are set
  • All headers in module related configuration serverHeaders are set
  • All headers in module related configuration nuxtHeaders are set
  • All headers in vue file are set.

Special thanks