Skip to content
Permalink
Browse files
fix(plugin): preserve default headers (fixes #323)
  • Loading branch information
pooya parsa committed Apr 21, 2020
1 parent fd1f8ec commit 6c5605df0b77e9e4df32ad1eaecb2eac60eb1c1d
Showing 1 changed file with 8 additions and 3 deletions.
@@ -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

0 comments on commit 6c5605d

Please sign in to comment.