proxyTable doesnt change my Origin Header and CORS erros occur
-
this is my configuration:
proxyTable: {
‘/’: {
target: ‘http://localhost/isaac/’,
changeOrigin: true,
secure: false,
headers: {
Origin: ‘http://localhost/isaac/’
}
/* cookieDomainRewrite: ‘http://localhost/isaac/’,
onProxyReq: function (request, req, res) {
request.setHeader(‘origin’, ‘http://localhost/isaac/’)
}
*/
}
}i see in the console requested url is the correct but apache server return a cors error and the requested header shows me:
Origin http://localhost:8081
which should be http://localhost:80/ to avoid cors errors i suppouse
i have no more ideas of how figure it out, please help me
thanksPD im using codeigniter framework
-
try setting
'Access-Control-Allow-Origin': 'http://localhost:8081'
in your backend on every response -
thanks, but i did not want to use ‘Access-Control-Allow-Origin’: ‘http://localhost:8081’ in my backend, thats why i tried to use a proxy…
And i resolved with this config:
proxyTable: {
‘/index.php/**’: {
target: ‘http://localhost:80/isaac/’,
‘changeOrigin’: true,
secure: false,
logLevel: ‘debug’,
headers: {
‘Origin’: ‘http://localhost:80’
}
}
}It seems my attemps to get it run failed because of the route ‘/’ instead of ‘index.php/**’
thanks again, now it is working fine