Registry / devops / fast-proxy-lite

fast-proxy-lite

JSON →
library1.1.3jsnpmunverified

A lightweight, framework-agnostic HTTP/HTTPS proxy library for Node.js (v1.1.3, last released 2022, stable). Forked from fastify/fast-proxy, it provides request forwarding with caching, custom agents, and header rewriting. It is used by fast-gateway and is smaller than alternatives like http-proxy. Supports Node >=10.

npm install fast-proxy-lite
INSTALL
IMPORT
SIG · FAST-PROXY-LITE
F
fast-proxy-lite
devopsjavascriptv1.1.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import fastProxy from 'fast-proxy-lite'
const proxy = require('fast-proxy-lite')
Default export is a factory function. Use named imports for destructured proxy/close.
proxy
const { proxy } = fastProxy({ base: 'http://localhost:3000' })
const proxy = require('fast-proxy-lite').proxy
proxy and close are created by calling the default export factory, not exported directly.
close
const { close } = fastProxy({ base: 'http://localhost:3000' })
const close = require('fast-proxy-lite/close')
close is a cleanup function returned from the factory, not a standalone export.

Creates a proxy instance with base URL and forwards all /service/* requests to the remote server.

import fastProxy from 'fast-proxy-lite' import restana from 'restana' const { proxy, close } = fastProxy({ base: 'http://127.0.0.1:3000', cacheURLs: 100, keepAliveMsecs: 60000, maxSockets: 2048 }) const gateway = restana() gateway.all('/service/*', (req, res) => { proxy(req, res, req.url, {}) }) gateway.start(8080).then(() => { console.log('Gateway running on port 8080') }) // On shutdown: // close()
Debug
Known issues
gotchaDefault export is a factory function, not a proxy instance. You must call it with options to get proxy and close.
fix
const { proxy } = require('fast-proxy-lite')({ base: '...' })
affects: >=1.0.0
gotchaThe base option is required; if not set, proxy will fail because downstream URL cannot be resolved.
fix
Always pass a base URL to the factory function.
affects: >=1.0.0
gotchaRejectUnauthorized defaults to true, so requests to self-signed HTTPS servers will fail.
fix
Set { rejectUnauthorized: false } in factory options for self-signed certs.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: proxy is not a function
The default export is a factory, not a proxy function. The user did not call it with options.
fix
const { proxy } = require('fast-proxy-lite')({ base: 'http://localhost:3000' })
Error: getaddrinfo ENOTFOUND
The base URL is missing or malformed in the factory options.
fix
Ensure the base option is set to a valid URL string like 'http://localhost:3000'.
Error: self-signed certificate in certificate chain
The downstream server uses a self-signed certificate, and rejectUnauthorized defaults to true.
fix
Add { rejectUnauthorized: false } to the factory options.
Upgrade
Version history
1.1.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
fast-proxy-lite — npm install fast-proxy-lite · libregistry