'Can't set headers after they are sent' with express
Created by: jnjnljljjsw
my node.js version is 4.2.2
app.js:
var api = require('./routes/api'); app.use('/api', api);
api.js
proxy.on('proxyReq', function(proxyReq, req, res, options) { proxyReq.setHeader('X-Special-Proxy-Header', 'foobar'); }); router.all("/*", function(req, res){ proxy.web(req, res, { target: 'http://dev.lalocal.cn:8080/api' }); });
error: Error: Can't set headers after they are sent.