http-debugging-proxy.js
✓ Published0🌍 Public
Aalessioalex
Last edited Nov 22, 2014
Created on Nov 22, 2014
This example demonstrates a custom HTTP proxy server that intercepts requests and serves local files or forwards traffic to a remote target. The code uses Node.js’s `http` module and the `http-proxy` library to create a server listening on port 5050. It checks the request URL for specific paths like `/package/http-proxy` or `/local.css` to stream local HTML or CSS files via `fs.createReadStream`. All other requests are proxied to `https://www.npmjs.org` using `proxy.web(req, res, { target })`, showing conditional routing and file serving alongside proxying.
AI-generated description