Open motin opened 6 years ago
Thanks @motin There's an issue with http-proxy@1.17.0. I don't have the bandwidth to investigate if this is a bug in 1.17.0 or if we should modify this package.
But if you need to make forward progress I would suggest downgrading to 1.15.1 as specified in the test. I've tightened the package.json so the tests pass https://github.com/No9/harmon/commit/e52b83d9ae0923bd33f8556e7a34b77ec05f56d6
Happy to take a PR if the investigation points to it being a need to upgrade this package
Additional investigation shows that the harmon tests pass up to @1.16.2
Thanks @No9 for pointing this out. Btw, shouldn't some of these devDependencies be actual dependencies? Currently when including harmon in another project, neither connect nor http-proxy gets installed.
Hey @motin The lack of inclusion of connect and http-proxy is by design - harmon follows the middleware pattern so it should be possible to use it be usable outside of those two frameworks and I prefer libraries over frameworks but YMMV :)
Hmm it seems like this broke when we stopped explicitly calling res.writeHead. I thought the internal call by node itself would allow it to still work but I guess not. The reason we switched to just assigning statusCode and allowing it to implicitly writeHead
was to prevent headers were already sent errors from being thrown in certain edge cases. I'd like to see if harmon could work without overriding res.writeHead. any thoughts @No9?
@jcrugzz Yes! Maybe we should have coordinated on this one 😝
@No9 (written before I refreshed the page and saw the previous response) After some investigation I believe I found the culprit of this bug. It has to do with http-proxy not using writeHead in their latest build http-proxy #953 fix I can patch it up but I need a little bit of guidance.
The issue is that res.write
is running before res.writeHead
therefore res.isHtml
isn't being set prior to rewriting the body and replacing the content through trumpet. I'm guessing this is due to res.writeHead
not being explicitly called by http-proxy anymore. Is there somewhere where I can configure what order these events fire in?
Any updates on this? Is this issue fixed now or should an old version of http proxy be used?
I've opened #50 to address the issue with http-proxy. Feedback definitely welcome!
@leveneg Thanks for this - I'll take a look this week and provide feedback
This project looks exactly like what I was looking for, but I got nothing to work.
It seems to be a general issue, with CircleCI on a fork of the current master failing as well: https://circleci.com/gh/motin/harmon/1
I tried node versions 8, 4 and 0.10 to no avail.