I'm using this library to forward api-request from grunt (port 9000) to my api at node (port 3012). https://github.com/drewzboto/grunt-connect-proxy
It works when the response from the server is a json. But it does not work when it's a image.
I tried to make a proxy with apache and there it works. So it must be something wrong with my proxy in grunt.
This is the response in chrome from apache:
This is the repsonse in chrome from grunt server
The response tab is empty
These are the relevant packages I'm using:
"grunt": "^0.4.1",
"grunt-connect-proxy": "^0.2.0",
This is the proxy in my gruntfile.js
proxies: [
{
context: '/api_paros',
host: 'localhost',
port: 3012,
https: false
}
],
livereload: {
options: {
open: true,
base: [
'.tmp',
'<%= yeoman.app %>'
],
middleware: function (connect, options) {
if (!Array.isArray(options.base)) {
options.base = [options.base];
}
// Setup the proxy
var middlewares = [require('grunt-connect-proxy/lib/utils').proxyRequest];
middlewares.push(connect.static('.tmp'));
middlewares.push(connect().use(
'/bower_components',
connect.static('./bower_components')
));
middlewares.push(connect.static(appConfig.app));
// Serve static files.
options.base.forEach(function (base) {
middlewares.push(connect.static(base));
});
// Make directory browse-able.
var directory = options.directory || options.base[options.base.length - 1];
middlewares.push(connect.directory(directory));
return middlewares;
}
}
},
Any ideas?