Hi,
Have a little server-side code. We have an old website and going to “transfer” some of pages from there:
Request = Npm.require('request')
Fiber = Npm.require('fibers')
WebApp.rawConnectHandlers.use (req, res, next) ->
handle = ->
dispatchRoute(req, res, next)
if Fiber.current
handle()
else
fiber = new Fiber(handle)
fiber.run()
dispatchRoute = (req, res, next) ->
# little check here and
# call next() if we do not need to request for old page
opt =
url: Meteor.settings.oldDomainUrl
headers: req.headers
Request opt, (err, answ, body) ->
res.writeHead(200, answ.headers).end(body)
It worked ok, until I decided to transfer all the headers from origin. And now res.writeHead(200, answ.headers).end(body)
crashes the app. I found that it is about answ.headers
. So I’ve tryed to set headers from answ
with res.setHeader
but got crashes again. It works fine if I do not touch answ.headers
. Checked for pure node.js + Connect and the code works without any problems. Could it be Meteor or WebApp issue