---
title: Proxy Analytics SDK requests
description: Route Analytics SDK ingestion and Browser SDK 2 remote configuration requests through your server.
product: analytics
lang: en
token_estimate: 565
---
# Proxy Analytics SDK requests

> For AI agents: a documentation index is available at [/docs/llms.txt](/docs/llms.txt). Append `.md` to any page URL for markdown, or send `Accept: text/markdown`.

Route Analytics SDK requests through your own server when you need traffic to pass through your domain before reaching Amplitude. For Session Replay ingestion and configuration endpoints, use [Proxy Session Replay requests](https://amplitude.com/docs/session-replay/proxy-replay-requests).

## Configure the proxy

1. Accept SDK requests at your custom URL.
2. Forward the full request body and all headers except `Host` to the corresponding Amplitude endpoint.
3. Return Amplitude's status code, headers, and response body unchanged.

Don't strip, modify, or buffer the request or response payload. The SDK handles retries. If you need an `Authorization` header for a downstream service, inject it in the proxy to keep credentials out of client-side code.

## Configure the Analytics SDK

Applies to: Browser SDK, Android (Kotlin) SDK, iOS (Swift) SDK, React Native SDK, Node.js SDK, Python SDK, Go SDK.

Use the `serverUrl` configuration option to point the SDK at your proxy:

```js
amplitude.init('API_KEY', {
  serverUrl: 'https://analytics.yourdomain.com/2/httpapi'
});
```

Your proxy should forward requests to the appropriate Amplitude endpoint:

| Region | Default endpoint |
| --- | --- |
| US | `https://api2.amplitude.com/2/httpapi` |
| EU | `https://api.eu.amplitude.com/2/httpapi` |
| US (batch) | `https://api2.amplitude.com/batch` |
| EU (batch) | `https://api.eu.amplitude.com/batch` |

Use the batch endpoints for high-volume environments. To enable batch mode, set `useBatch: true` on the SDK and point `serverUrl` at your proxy path that forwards to the batch endpoint:

```js
amplitude.init('API_KEY', {
  useBatch: true,
  serverUrl: 'https://analytics.yourdomain.com/batch'
});
```

## Remote config proxy (Browser SDK 2 only)

Browser SDK 2 fetches remote configuration separately. To proxy those requests as well, use the `remoteConfig.serverUrl` option:

```js
amplitude.init('API_KEY', {
  serverUrl: 'https://analytics.yourdomain.com/2/httpapi',
  remoteConfig: {
    serverUrl: 'https://analytics.yourdomain.com/config'
  }
});
```

