Domain Proxy

Introduction and Motivation

A proxy service relays requests between a client and another service, acting as an intermediary step. Building a proxy service for your Amplitude org allows you to proxy requests to the Amplitude API through your own domain. For example, you can send requests on client browsers to instead of directly to, with your proxy then relaying that request to the Amplitude platform.

Sending data through a self-owned proxy service allows for better control of the data you collect and send to the Amplitude platform, including but not limited to:

  • Ability to easily turn on and off event flow to Amplitude
  • Self-owned audit logging of data
  • Easier debugging, filtering, and blocking of events
  • Anonymization of end-users (remove originating IP address, location, userID, etc)

Proxy services can be integrated into existing API endpoints or built as standalone services. In addition, many cloud providers allow for easy, flexible, and reliable configuration of such services. This guide provides a few possible solutions for building a simple proxy, and how to integrate the SDK’s to use a proxy instead of directly sending data to Amplitude.

For this guide, we will focus on building a proxy to Amplitude’s HTTP API ( where events are sent directly to our platform. In larger organizations, we highly recommend discussing with your devops and infosec teams before choosing and deploying a proxy server.

Proxy Services and the JS Snippet

While it is possible to build a proxy solution to support the loading of the JS Snippet, we encourage modern web developers to bundle Amplitude into their production builds using our npm distribution.

Available Services on Major Cloud Providers

Most major cloud providers often provide their own services to allow for easy development and deployment of scalable API’s. API services can also be used to set up outbound traffic to Amplitude; if you use a cloud provider to deploy API services, refer to their documentation to set up a proxy service and for their quickstart guides:

Amazon Web Services: API Gateway
Microsoft Azure: API Management
Google Cloud: API Gateway

Building Out a Proxy Solution

There are also many ways to build a proxy server by yourself. For example, NGINX is an open-source solution to building a proxy. If you already have a Node API server, you could consider using the Node SDK to pass events from your own endpoint to the main Amplitude event servers.

The rest of this portion outlines how to locally setup and test a NGINX server, and then how to deploy and validate that service for external use.

Setting Up an NGINX Server

First you will need to install NGINX for local development. Now you will need to configure NGINX to proxy requests on a particular URL to Amplitude. Here is a sample nginx.conf file that proxies requests from the /amplitude route to

worker_processes  1;

error_log  logs/error.log;
error_log  logs/error.log  notice;
error_log  logs/error.log  info;

events {
    worker_connections  1024;

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;

    keepalive_timeout  65;

    server {
        listen       8080;
        server_name  localhost;

        location /amplitude {

Validation and Deployment

Once you setup this config file, you should be able to start and test your proxy. Using our HTTP API, you will just need to send the requests to your endpoint rather than to ours.

IMPORTANT : the HTTP API uses a slightly different endpoint from our SDKs, so to test, you will need to temporarily set proxy_pass to

Here is an example curl command that would test your reverse proxy:

curl --data 'api_key=API_Key' --data-urlencode 'event=[{"user_id":"12345", "event_type":"test_proxy_event", "time":1396381378123}]' http://localhost:8080/amplitude/

This call should return a 200 response code. You can also confirm that the event is received correctly by Amplitude with our User Lookup view (by using your user ID or unique identifier). After confirming that this works locally, you should be able to deploy the configuration to a production server.

Configuring the SDKs to work with alternate endpoints

Now that you have the proxy working, you need to configure the SDK. Amplitude’s SDKs are open source code that you can modify as desired, and already have built-in options to send events to your defined server endpoint.

IMPORTANT: The SDK's do not point at the same API endpoint as the HTTP API V2, but rather a special endpoint for its custom payloads. Send them instead to

JS (Web): Set the apiEndpoint option when initializing the SDK.
iOS/Android: Use the setServerUrl function to configure the server url.

Once you do that, you should be able to send events through your proxy and see them logged in Amplitude.

Did this page help you?