Skip to content

Commit

Permalink
fix(plugin): preserve default headers (fixes nuxt-community#323)
Browse files Browse the repository at this point in the history
  • Loading branch information
pooya parsa committed Apr 21, 2020
1 parent fd1f8ec commit 6c5605d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,14 @@ export default (ctx, inject) => {

<% if (options.proxyHeaders) { %>
// Proxy SSR request headers headers
axiosOptions.headers.common = (ctx.req && ctx.req.headers) ? Object.assign({}, ctx.req.headers) : {}
<% for (let h of options.proxyHeadersIgnore) { %>delete axiosOptions.headers.common['<%= h %>']
<% } %><% } %>
if (process.server && ctx.req && ctx.req.headers) {
const reqHeaders = { ...ctx.req.headers }
for (let h of <%= serialize(options.proxyHeadersIgnore) %>) {
delete reqHeaders[h]
}
axiosOptions.headers.common = { ...reqHeaders, ...axiosOptions.headers.common }
}
<% } %>

if (process.server) {
// Don't accept brotli encoding because Node can't parse it
Expand Down

0 comments on commit 6c5605d

Please sign in to comment.