错误:在sails.js v0.11中发送标题后无法设置标题

时间:2015-03-04 12:19:55

标签: node.js express sails.js

我已将项目从风帆v0.9.8升级到风帆v0.11。我何时尝试检索数据,它会出现此错误。

  

错误:发送后无法设置标头。       在ServerResponse.OutgoingMessage.setHeader(http.js:690:11)       在ServerResponse.appendHeader(/usr/lib/node_modules/sails/node_modules/express/node_modules/connect/lib/patch.js:94:33)       在ServerResponse.res.setHeader(/usr/lib/node_modules/sails/node_modules/express/node_modules/connect/lib/patch.js:125:19)       在ServerResponse.res.set.res.header(/home/abc/xyz/git/propgod-internal-V0.11/clients/web/node_modules/sails/node_modules/express/lib/response.js:577:10)       在ServerResponse.res.cookie(/home/abc/xyz/git/propgod-internal-V0.11/clients/web/node_modules/sails/node_modules/express/lib/response.js:650:8)       在Request.callback [as _callback](/home/abc/xyz/git/propgod-internal-V0.11/clients/web/api/services/DataService.js:51:34)       在Request.self.callback(/home/abc/xyz/git/propgod-internal-V0.11/clients/web/node_modules/request/request.js:123:22)       在Request.emit(events.js:98:17)       在请求。 (/home/abc/xyz/git/propgod-internal-V0.11/clients/web/node_modules/request/request.js:1047:14)       在Request.emit(events.js:117:20)       在IncomingMessage。 (/home/abc/xyz/git/propgod-internal-V0.11/clients/web/node_modules/request/request.js:998:12)       在IncomingMessage.emit(events.js:117:20)       at _stream_readable.js:944:16       at process._tickDomainCallback(node.js:486:13)

     

如何为我的应用程序启用cors?

注意:我正在使用Gruntfile.js加载脚本和样式。        我有单独的客户端和服务器端模块。

请帮帮我!!!

1 个答案:

答案 0 :(得分:1)