-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Server Crashing with "Cannot set headers after they are sent to the client" #634
Comments
Currently I am just using a catch-all error handler and running off the source code rather than the global package. So just having a handler for that error would be a quick fix. |
This only happens with known file extensions, in my case txt, json, etc. Not sure what headers are being sent early, but without looking at the source, I'm sure it's trying to set the mime-type header, which it fails to do. |
In my case it was happening for .json files, easy solution was to rollback to version 13.0.2 |
Same issue. Rolling back to 13.0.2 worked |
This is kind of a duplicate of #756 , in both cases the headers error hides some problem deeper in the code. Proposed improvement in #791. @shrimpwagon since you do not experience this with older versions of http-server, I think you might have the problem described in #756 and may be able to solve it by updating Node to 12.16 or later. @thornjad maybe you can close this issue as duplicate, also please check the PR #791 if you have time. |
… after they are sent to the client"](http-party/http-server#634)
… after they are sent to the client"](http-party/http-server#634)
…ot set headers after they are sent to the client"](http-party/http-server#634)
I confirm, that the installation of v13 .. 13.1.0 works. |
@jirikrepl is it also OK if you keep the latest http-server and update node to the latest 12.X, 14.X or 16.X? |
@zbynek thanks! it was crashing for node 10, version http-server v14 works fine with node 16 |
Same issue. Rolling back to 13.0.2 worked. Thanks! |
Working with 16 as well! Thanks! |
Steps to reproduce the issue, if applicable. Include the actual command and output and/or stack trace.
Not sure sorry as there is a lot of traffic on the server, just appears to all be normal GET requests.
What did you expect to happen?
The server to not crash. Ideally the error would be returned as a 503.
Tell us about your environment
Windows Server 2016
Node.js v12.14.1
Latest Version (Embedded/Global CLI Version from NPM)
Other information (related issues, suggestions for a fix, etc):
As far as I am aware the only thing that really needs to be done is catching the error and returning 503.
The text was updated successfully, but these errors were encountered: