A small middleware for fetch() that adjusts request URLs based on X-Forwarded-Host and X-Forwarded-Proto headers when running behind a reverse proxy. Version 0.2.0, stable. Key differentiator: lightweight, zero-dependency, works across Deno, Bun, and Node.js (uses @hono/node-server). Handles proxy-aware URL reconstruction without modifying existing fetch handlers.
npm install x-forwarded-fetchNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Node.js example: wraps a fetch handler with behindProxy to show proxied URL.
Use '@hongminhee/x-forwarded-fetch' in Deno, 'x-forwarded-fetch' in Bun/Node.
If you need other X-Forwarded-* headers, combine with additional middleware.
Pin version to avoid unexpected changes.
Use 'x-forwarded-fetch' instead of '@hongminhee/x-forwarded-fetch'.
Use import { behindProxy } from 'x-forwarded-fetch'.Ensure the proxy sends headers and that the handler is wrapped: behindProxy(yourHandler).