Skip to content

Commit

Permalink
fix(proxy): deflate gziped responses
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyperkid123 committed Jan 28, 2025
1 parent 174ffcd commit 129b276
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions packages/config-utils/src/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,6 @@ const proxy = ({
secure: false,
changeOrigin: true,
autoRewrite: true,
onProxyReq: (proxyReq, req) => {
if (isInterceptAbleRequest(req.url)) {
// necessary to avoid gzip encoding and issues with parsing the json body
proxyReq.setHeader('accept-encoding', 'gzip;q=0,deflate,sdch');
}
},
onProxyRes: (proxyRes, req, res) => {
// this should reading the aggregated bundles filed generated from chrome service
// The functionality is disabled until the interceptor is ready
Expand Down Expand Up @@ -319,15 +313,21 @@ const proxy = ({

return null;
},
...(agent && {
agent,
headers: {
// Staging Akamai CORS gives 403s for non-GET requests from non-origin hosts
Host: target.replace('https://', ''),
// Origin format is protocol://hostname:port only, remove any trailing slash
Origin: target.replace(/\/$/, ''),
},
}),
...(agent
? {
agent,
headers: {
// Set FEO gzip headers here to prevent issues with setting headers after response was closed
'accept-encoding': 'gzip;q=0,deflate,sdch',
// Staging Akamai CORS gives 403s for non-GET requests from non-origin hosts
Host: target.replace('https://', ''),
// Origin format is protocol://hostname:port only, remove any trailing slash
Origin: target.replace(/\/$/, ''),
},
}
: {
'accept-encoding': 'gzip;q=0,deflate,sdch',
}),
});
}

Expand Down

0 comments on commit 129b276

Please sign in to comment.