Package Exports
- undici-proxy
- undici-proxy/lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (undici-proxy) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
undici-proxy
Yet another express proxy middleware based on undici.
Install
npm install undici-proxy
# or
yarn add undici-proxy
Usage
import express from 'express'
import proxy from 'undici-proxy'
const app = express()
app.use(proxy('https://httpbin.org'))
app.listen(3000)
// Now you can access https://httpbin.org/ using http://localhost:3000/
Config
The proxy()
function also accepts an undici Pool, so you can use it like:
const express = require('express');
const proxy = require('koa-undici-proxy');
const { Pool } = require('undici');
const app = express()
const pool = new Pool('https://httpbin.org', {
// I want to proxy big blobs so disable the timeout of receiving body.
bodyTimeout: 0,
})
app.use(proxy(pool))
app.listen(3000)
License
MIT