> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/honojs/hono/llms.txt
> Use this file to discover all available pages before exploring further.

# Proxy Helper

> Forward requests to backend servers

The Proxy Helper provides functionality to proxy requests to backend servers with automatic header handling.

## Import

```typescript theme={null}
import { proxy } from 'hono/proxy'
```

## Functions

### proxy()

Proxy a request to a backend server.

```typescript theme={null}
function proxy(url: string | URL, options?: ProxyOptions): Response | Promise<Response>
```

<ParamField path="url" type="string | URL" required>
  The target URL to proxy to
</ParamField>

<ParamField path="options" type="ProxyOptions">
  Optional proxy configuration
</ParamField>

<ResponseField name="return" type="Response | Promise<Response>">
  The proxied response
</ResponseField>

**Example**

```typescript theme={null}
import { proxy } from 'hono/proxy'

app.get('/proxy', (c) => {
  return proxy('https://api.example.com')
})
```

## Options

```typescript theme={null}
type ProxyOptions = {
  fetch?: typeof fetch
}
```

<ParamField path="fetch" type="typeof fetch">
  Custom fetch implementation
</ParamField>

## Advanced Usage

```typescript theme={null}
import { proxy } from 'hono/proxy'

// Proxy with path forwarding
app.get('/api/*', (c) => {
  const path = c.req.path.replace(/^\/api/, '')
  return proxy(`https://backend.com${path}`)
})

// Proxy with custom fetch
app.get('/secure/*', (c) => {
  return proxy('https://backend.com', {
    fetch: customFetch
  })
})
```

## Security Features

* Automatically removes hop-by-hop headers
* Prevents Connection header injection
* Handles encoding properly
* Preserves request body and method
