# createUncageHandler

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

```ts
function createUncageHandler(o?): UncageHandler;
```

Defined in: proxy.ts:144

Creates the GET/POST/PATCH route handlers. Request bodies (e.g. attachment uploads) stream upstream
byte for byte, and response bodies (event streams, attachment downloads) stream back.

Requests whose `Host` header hostname is not allowed get 403 `forbidden_origin` and nothing is forwarded; this stops DNS-rebinding pages (evil.com resolving to
127.0.0.1, so Origin and Host agree) from driving the daemon through the host app. Allowed hosts
default to loopback names; set `allowedHosts: ['app.example.com']` or env `UNCAGE_ALLOWED_HOSTS`
(comma-separated) when serving the host app on another hostname.

## Parameters

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

## Returns

[`UncageHandler`](https://uncage.vercel.app/docs/api/server/proxy/interfaces/uncagehandler.md)
