
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
domain-http-server
Advanced tools
A handy little decorator for adding domain functionality to your HTTP server's request and response objects.
var dhs = require('domain-http-server')
http.createServer(function (req, res) {
dhs(req, res, { close: true, callback: errorHandler })
// proceed to do stuff.
});
// express style
app.use(dhs)
// close the server on errors
app.use(dhs.defaults({ close: true });
// call a specific callback on errors
app.use(dhs.defaults({ callback: errorHandler })
close Boolean, default=true. Close the server when there's an
error, so that it stops accepting requests. This is handy when
running as part of a cluster, so that unknown-state processes can be
cleaned up and replaced.enter Boolean, default=true. Enter the domain immediately, so
that errors thrown in the server's request handler will be caught.exit Boolean, default=true. Exit the domain when there's an error.callback Function. A function that will be called when an error
occurs.Also, if the response has an error member which is a function, then
it'll call that when there's an error.
If there's no res.error method, and there's no callback option,
then it'll throw the error.
dhs(req, res, options, next) Attach the domain to the request and
response. Options object is optional. next callback is there for
the benefit of express-style middleware usage.dhs.defaults(options) Return a dhs function that'll use the
supplied options.FAQs
A module for attaching domains to request and response objects
We found that domain-http-server demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.