# createUncageNodeHandler

<!-- https://uncage.vercel.app/docs/api/server/proxy/functions/createuncagenodehandler/ -->

```ts
function createUncageNodeHandler(o?): UncageNodeHandler;
```

Defined in: proxy.ts:281

The same proxy as a Node `(req, res, next?)` handler for Express, Connect, Fastify
(`reply.hijack()` then `handler(request.raw, reply.raw)`) and `node:http`:

  app.use('/api/uncage', createUncageNodeHandler());

The URL is rebuilt from `req.originalUrl` (Express) or `req.url`, and the browser's `Host`
header, so mount it under `basePath` (default `/api/uncage`) without rewriting Host. Mount it
before body parsers and compression: request bodies stream upstream untouched (a body already
parsed by `express.json()` is re-encoded as JSON), and event streams are written chunk by chunk
with backpressure. Disconnecting browsers abort the upstream request. Behind a TLS terminator,
set Express `trust proxy` so `req.protocol` is `https` (the Origin check compares schemes).

## Parameters

| Parameter | Type |
| ------ | ------ |
| `o?` | [`ProxyOptions`](https://uncage.vercel.app/docs/api/server/proxy/interfaces/proxyoptions.md) |

## Returns

[`UncageNodeHandler`](https://uncage.vercel.app/docs/api/server/proxy/type-aliases/uncagenodehandler.md)
