My system: git bash on Windows 7
// The actual grunt server settings
connect: {
options: {
port: 8000,
// Change this to '0.0.0.0' to access the server from outside.
hostname: 'localhost',
livereload: 35729
},
proxies: [
{
context: '/api',
host: 'dev-maps.company.it',
port: '80',
https: false,
changeOrigin: true,
rewrite: {
'^/api': '/api'
}
}
],
...
The snippet above is part of my grunt file which gets executed when I use grunt serve
. What it does is to proxy the backend api to dev-maps.company.it
which is a company internal host that gets resolved through our DNS (and for sure some corporate proxies). My issue is that I'm getting a 404 response.
Now, when I place the URL (dev-maps.company.it
) in my browser, it properly resolves. My browser users a "proxy.pac" file which - if I'm not wrong - for this endpoint resolves to DIRECT (meaning no proxy). Through grunt connect
however it doesn't seem to be able to resolve it and thus I suspect grunt is using some other proxy.
I verified my git bash doesn't have any proxy environment variable set (like http_proxy or similar). Also, I tried to hack down a quick nodejs app which uses the http
package to execute a GET to dev-maps.company.it
and it works:
app.get('/api/v1/contexts', function(req, response){
var prot = options.port == 443 ? https : http;
var req = prot.request(options, function(res) {
var output = '';
console.log(options.host + ':' + res.statusCode);
res.setEncoding('utf8');
res.on('data', function (chunk) {
output += chunk;
});
res.on('end', function() {
var obj = JSON.parse(output);
response.send(obj);
});
});
req.on('error', function(err) {
//res.send('error: ' + err.message);
});
req.end();
});
Does anyone have an idea where else I could be looking for???