In my application, I'm using a REST client and an Angular application generated by composer-cli. In sometimes, the REST client is terminated while I'm using the Angular app.
I noticed that this termination happens especially whenever I'm trying to use images in the Angular app. It seems an unwanted request is sent to the REST client when the image is loading.
REST client's log is as below.
I'm using a default generated Angular app. Any suggestions?
I figured out the issue in my code. It was in the auto-generated proxy configuration file (proxy.conf.js).
module.exports = [{
context: ['/auth', '/api'],
target,
secure: true,
changeOrigin: true
}, {
context: '/',
target,
secure: true,
changeOrigin: true,
ws: true,
bypass: function (req, res, proxyOptions) {
const accept = req.headers.accept || '';
if (accept.indexOf('html') !== -1) {
return '/index.html';
}
}
}];
I changed above part to,
module.exports = [{
context: ['/auth', '/api'],
target,
secure: true,
changeOrigin: true
}];
and also images should be located in ./src/assets
folder.