So I\'m using a yeoman project from swiip called generator-gulp-angular - just do \"npm search gulp-angular\" and you\'ll see it.
Out of the box the client is running fr
You have to setup a proxy server to forward your requests, setup a reverse proxy, or setup CORS on the back-end to allow the cross-origin request.
Some information on the erroneous request/response would be helpful too.
You could try to set the changeOrigin
param to true. This will modify the request's host header to match the server's hostname.
var proxyMiddleware = require('http-proxy-middleware');
var options = {
target: 'http://127.0.0.1:8080',
changeOrigin: true // <-- changeOrigin
};
If that doesn't work; you can add the Access-Control-Allow-Origin
header to the response:
var proxyMiddleware = require('http-proxy-middleware');
var options = {
target: 'http://127.0.0.1:8080',
onProxyRes: function (proxyRes, req, res) {
proxyRes.headers['Access-Control-Allow-Origin'] = '*';
}
};
http-proxy-middleware onProxyRes
option is added in v0.5.0 , so make sure to update it if you're still using v0.0.5