I’ve updated my Angular app to 18 version. I’m behind a corporate proxy, with my proxy file looking like this:
let proxyConfig = {
'/test/**': {
target: 'https://myUrl/test',
secure: true,
changeOrigin: true,
logLevel: 'debug',
pathRewrite: { '^/test': '' },
}
function setupForCorporateProxy(proxyConfig) {
const proxyServer = process.env.http_proxy || process.env.HTTP_PROXY;
if (proxyServer) {
const agent = new HttpsProxyAgent(proxyServer);
Object.keys(proxyConfig).forEach(function (key) {
proxyConfig[key].agent = agent;
});
}
return proxyConfig;
}
module.exports = setupForCorporateProxy(proxyConfig);
After the update, every request is failing on localhost. Still, for the GET request I found a solution by adding two ** instead of one * in the proxy configuration. Anyway, any POST/PUT/DELETE request is breaking the app with this error:
at onSocketNT (node:_http_client:902:5)
at process.processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: 'ERR_HTTP_HEADERS_SENT'
Node.js v20.15.0
What could be the issue? Seems very strange, because the update was fine, but it broke the proxy config.