{"id":17256,"library":"http-forward","title":"Simple HTTP Request Forwarder","description":"http-forward is a minimalist Node.js library designed to proxy incoming HTTP requests to a specified target URL. It functions by attaching a `target` property to the `req.forward` object, allowing for basic request redirection within a Node.js `http.createServer` instance. This package is extremely lightweight and relies solely on Node.js's built-in `http` module. However, with its last publish date over ten years ago (version 0.1.3) and no apparent ongoing development, it is considered abandoned. It does not support modern JavaScript module syntax (ESM), HTTP/2, or contemporary security practices, and has no release cadence. Users are strongly advised to consider actively maintained and more feature-rich alternatives such as `http-proxy` or `http-proxy-middleware` for any new or existing projects requiring HTTP proxying in Node.js.","status":"abandoned","version":"0.1.3","language":"javascript","source_language":"en","source_url":"https://github.com/h2non/http-forward","tags":["javascript","forward","http","proxy","incoming","reverse"],"install":[{"cmd":"npm install http-forward","lang":"bash","label":"npm"},{"cmd":"yarn add http-forward","lang":"bash","label":"yarn"},{"cmd":"pnpm add http-forward","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is CommonJS-only and does not support ES module `import` syntax. It was published long before ESM was standardized in Node.js.","wrong":"import forward from 'http-forward'","symbol":"forward","correct":"const forward = require('http-forward')"}],"quickstart":{"code":"const http = require('http');\nconst forward = require('http-forward');\n\n// A basic target server to forward requests to\nconst targetServer = http.createServer((req, res) => {\n  console.log(`Target server received: ${req.method} ${req.url}`);\n  res.writeHead(200, { 'Content-Type': 'text/plain' });\n  res.end('Hello from the target server!');\n});\ntargetServer.listen(9000, () => {\n  console.log('Target server listening on port 9000');\n});\n\n// The proxy server that uses http-forward\nconst proxyServer = http.createServer((req, res) => {\n  console.log(`Proxy server received: ${req.method} ${req.url}`);\n  // Define the target for http-forward\n  req.forward = { target: 'http://localhost:9000' };\n  forward(req, res, (err) => {\n    if (err) {\n      console.error('Proxy error:', err.message);\n      res.writeHead(500, { 'Content-Type': 'text/plain' });\n      res.end('Proxy Error');\n    }\n  });\n});\n\nproxyServer.listen(3000, () => {\n  console.log('Proxy server listening on port 3000. Try curl http://localhost:3000');\n});","lang":"javascript","description":"This example sets up a simple proxy server on port 3000 that forwards all incoming HTTP requests to a target server running on port 9000."},"warnings":[{"fix":"Migrate to a maintained HTTP proxy library such as `node-http-proxy` or `http-proxy-middleware`.","message":"The `http-forward` package is abandoned and has not been updated in over ten years. It should not be used in production environments due to potential unpatched security vulnerabilities and incompatibility with modern Node.js versions and features.","severity":"breaking","affected_versions":"<=0.1.3"},{"fix":"Ensure your project is configured for CommonJS, or migrate to a modern proxy library that supports ESM. Consider using a CommonJS-to-ESM wrapper if absolutely necessary, but this is not recommended for an abandoned package.","message":"This package is CommonJS-only and relies on `require()` statements. It does not support ES Modules (`import`/`export`) or modern JavaScript bundling techniques, which can lead to compatibility issues in contemporary Node.js projects.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"For projects requiring HTTP/2, WebSocket proxying, or advanced features, use modern, actively maintained proxy libraries or dedicated proxy servers (e.g., Nginx, HAProxy, Caddy, Traefik, or Node.js alternatives like `node-http-proxy-3`).","message":"Due to its age, `http-forward` lacks support for modern web protocols like HTTP/2 and advanced proxy features such as WebSocket forwarding, SSL/TLS termination at the proxy, or sophisticated routing rules.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"This package is CommonJS-only. You must use `const forward = require('http-forward');` to import it. Alternatively, configure your project to run as CommonJS or migrate to a modern proxy library that supports ESM.","cause":"Attempting to import `http-forward` using ES module syntax (`import forward from 'http-forward';`) in a Node.js environment configured for ESM.","error":"ERR_REQUIRE_ESM"},{"fix":"While specific fixes vary, common workarounds involve ensuring Node.js environment compatibility (which is hard for an ancient library) or, more reliably, migrating to a robust, actively maintained proxy solution that handles connection management more resiliently.","cause":"This error can occur with older Node.js modules when handling connections, especially under load or with modern client/server interactions, indicating a connection abruptly closed. It's often a symptom of incompatibility or unhandled edge cases in an unmaintained library.","error":"Error: read ECONNRESET"}],"ecosystem":"npm","meta_description":null}