Hostproxy
HTTP Proxy that searches for Host header and avoids any parsing
Install / Use
/learn @mikeal/HostproxyREADME
Pure TCP HTTP Proxy
hostproxy is a pure TCP proxy for HTTP. It does not fully parse HTTP, it simply searches for the Host header and injects other headers in to the stream.
API
var hostproxy = require('hostproxy')
, net = require('net')
;
hostproxy(function (host) {
if (host === 'mysite.com') return net.connect(80, 'mysite.com')
return net.connect(80, 'fallback.com')
}).listen(80)
If no host header is present then host will be null.
hostproxy(function (host) {
if (!host) return // returning nothing will force disconnect the client
return net.connect(80, host)
}).listen(80)
What about adding headers?
hostproxy(function (host, addHeader, address) {
addHeader('x-forwarded-for', address.address)
return net.connect(80, host || 'fallback.com')
}).listen(80)
The address param is the return value from socket.address().
Related Skills
node-connect
354.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
112.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
354.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
354.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
