diff --git a/nuxt/index.js b/nuxt/index.js index c0eec57..476ad29 100644 --- a/nuxt/index.js +++ b/nuxt/index.js @@ -23,6 +23,7 @@ const MandeModule = function NuxtMandeModule(localOptions) { this.addPlugin({ src: path.resolve(__dirname, 'plugin.js'), fileName: 'mande.js', + // FIXME: figure out why options end up being undefined options, }) } diff --git a/nuxt/plugin.js b/nuxt/plugin.js index b1671e7..da13851 100644 --- a/nuxt/plugin.js +++ b/nuxt/plugin.js @@ -1,4 +1,3 @@ - /** @type {import('@nuxt/types').Plugin} */ export default (ctx, inject) => { function mande(wrappedFn, ...args) { @@ -10,8 +9,18 @@ export default (ctx, inject) => { const reqHeaders = { ...ctx.req.headers } + const proxyHeadersIgnore = <%= serialize(options.proxyHeadersIgnore) %> || [ + 'accept', + 'host', + 'cf-ray', + 'cf-connecting-ip', + 'content-length', + 'content-md5', + 'content-type', + ] + // @ts-ignore - for (let header of <%= serialize(options.proxyHeadersIgnore) %>) { + for (let header of proxyHeadersIgnore) { delete reqHeaders[header] }