@qonfucius/nuxt-headers
v1.0.1
Published
Custom headers for nuxtJS
Downloads
23
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.
