For my local development system I am trying to serve front-end assets using grunt-contrib-connect. I need a cross-domain solution for using fonts in Firefox. The server runs just fine, but I cannot seem to get the headers set.
I am using version 0.7.1 of grunt-contrib-connect.
connect: {
dev: {
options: {
port: '9001',
base: 'build',
hostname: 'localhost',
keepalive: true,
middleware: function(connect, options, middlewares) {
// inject a custom middleware into the array of default middlewares
// this is likely the easiest way for other grunt plugins to
// extend the behavior of grunt-contrib-connect
middlewares.push(function(req, res, next) {
req.setHeader('Access-Control-Allow-Origin', '*');
req.setHeader('Access-Control-Allow-Methods', '*');
return next();
});
return middlewares;
}
}
}
}
Is there a problem using keepalive with middleware?