@qonfucius/nuxt-headers
v1.0.1
Published
Custom headers for nuxtJS
Downloads
61
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 toreq
in parameters. - Via
nuxtHeaders
, it will add to every page access, via middleware. You can access tocontext
in 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.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
- To MartinLG for the module "nuxt-custom-headers", especially for the method to get .vue information.