{"library":"proxy-test-server","title":"Proxy Test Server","description":"proxy-test-server is a lightweight Node.js module designed to create a simple HTTP proxy server, primarily for testing proxied connections. It specifically handles HTTP `CONNECT` requests, enabling clients to establish a tunnel through the proxy to a destination server, such as for HTTPS traffic. It does not provide full HTTP proxying (e.g., modifying HTTP headers directly) but focuses on the `CONNECT` method for transparent tunneling. The package is currently at version 1.0.0 and appears to be in a maintenance state, with no active development or a defined release cadence, indicating a stable but minimally evolving codebase. Its key differentiator is its straightforward, minimal implementation for verifying basic proxy connectivity, rather than offering advanced features like mocking, traffic inspection, or support for multiple proxy protocols (SOCKS, HTTPS) found in more comprehensive proxy tools like Mockttp or Check-Proxy.","language":"javascript","status":"maintenance","last_verified":"Sun Apr 19","install":{"commands":["npm install proxy-test-server"],"cli":null},"imports":["const HttpConnectProxy = require('proxy-test-server');","const proxy = new (require('proxy-test-server'))();","proxy.on('connect', (port, host, socket) => { /* ... */ });"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const HttpConnectProxy = require('proxy-test-server');\nconst proxy = new HttpConnectProxy();\nconst PORT = process.env.PROXY_PORT ? parseInt(process.env.PROXY_PORT) : 9999;\n\nproxy.listen(PORT, function () {\n    console.log(`HTTP CONNECT Proxy Server Listening on port ${PORT}`);\n});\n\nproxy.on('connect', function (port, host, socket) {\n    const time = new Date().toISOString().substr(0, 19).replace('T', '');\n    console.log(`[%s] From %s to %s:%s`, time, socket.remoteAddress, host, port);\n    socket.on('error', (err) => console.error(`Socket error for ${socket.remoteAddress}:`, err.message));\n});\n\nproxy.on('error', (err) => {\n    console.error('Proxy server error:', err.message);\n    if (err.code === 'EADDRINUSE') {\n        console.error(`Port ${PORT} is already in use. Try a different port or stop the conflicting process.`);\n    }\n});\n\nconsole.log('To test, run: curl -i -x http://127.0.0.1:9999 https://google.com');\n// Or if using a different port:\nconsole.log(`To test, run: curl -i -x http://127.0.0.1:${PORT} https://google.com`);\n\n// To stop the server gracefully\nprocess.on('SIGINT', () => {\n    console.log('\\nShutting down proxy server...');\n    proxy.close(() => {\n        console.log('Proxy server closed.');\n        process.exit(0);\n    });\n});","lang":"javascript","description":"Demonstrates how to initialize and start an HTTP CONNECT proxy server, listen for incoming connections, log proxy activity, and handle common errors like port conflicts. Includes instructions for testing with curl.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}