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 toreqin parameters. - Via
nuxtHeaders, it will add to every page access, via middleware. You can access tocontextin parameters. - In vue scripts, you can add a key
httpHeaders, with same behavior thannuxtHeaders, but specific for a page.
Priority
Lowest in list is prior
- All headers in config key
httpHeaders.serverHeadersare set - All headers in config key
httpHeaders.nuxtHeadersare set - All headers in module related configuration
serverHeadersare set - All headers in module related configuration
nuxtHeadersare set - All headers in vue file are set.
Special thanks
- To MartinLG for the module "nuxt-custom-headers", especially for the method to get .vue information.