Using corporate network to call the REST API but always facing 'Access-Control-Allow-Origin' issues. Please find below the proxy.config.js to enable the CORS. And I am using sample daily weather report api to generate the Line Chart. Please find below the API. I have attached the screenshot too, could you please help me to resolve the issue.
var HttpsProxyAgent = require('https-proxy-agent');
var proxyConfig = [{
context: '/',
target: 'https://samples.openweathermap.org',
secure: false
}];
function setupForCorporateProxy(proxyConfig) {
var proxyServer = process.env.http_proxy || process.env.HTTP_PROXY;
if (proxyServer) {
var agent = new HttpsProxyAgent(proxyServer);
console.log('Using corporate proxy server: ' + proxyServer);
proxyConfig.forEach(function(entry) {
entry.agent = agent;
});
}
return proxyConfig;
}
module.exports = setupForCorporateProxy(proxyConfig);