> For the complete documentation index, see [llms.txt](/llms.txt).

# Set up a simple reverse proxy

In this tutorial, you'll use [Caddy](https://caddyserver.com/) to set up a reverse proxy to route data from Infura to your own node.

## Prerequisites[​](#prerequisites "Direct link to Prerequisites")

- An [Ethereum project](/services/get-started/infura/) on Infura
- [Node.js installed](https://nodejs.org/en/download/)
- [Homebrew](https://brew.sh/) installed

## Steps[​](#steps "Direct link to Steps")

### 1\. Create a project directory[​](#1-create-a-project-directory "Direct link to 1. Create a project directory")

Create a new directory for your project. You can do this from the command line:

```
mkdir reverseProxy

```

Change into the new directory:

```
cd reverseProxy

```

### 2\. Install Caddy[​](#2-install-caddy "Direct link to 2. Install Caddy")

Install Caddy in the project directory using Homebrew:

```
brew install caddy

```

### 3\. Create the reverse proxy[​](#3-create-the-reverse-proxy "Direct link to 3. Create the reverse proxy")

To create the reverse proxy, create a text file named `Caddyfile` with the following content:

```
localhost

reverse_proxy https://mainnet.infura.io {
header_up Host
}

```

Ensure you replace `<YOUR-API-KEY>` with the API key for your Ethereum project.

In this example, the reverse proxy retrieves information from the Infura endpoint, and redirects it to `localhost`. Using `header_up Host` allows you to include your API key to both the Sepolia and localhost endpoints.

### 4\. Run the reverse proxy[​](#4-run-the-reverse-proxy "Direct link to 4. Run the reverse proxy")

In a new terminal window, from your project directory, run the reverse proxy using Caddy:

```
caddy run

```

### 5\. Make a request[​](#5-make-a-request "Direct link to 5. Make a request")

In a new terminal window, make a curl request to `localhost`. The following example executes a `web3_clientVersion` request:

- Example curl HTTPS request
- Example JS result

```
curl https://localhost/v3/<YOUR-API-KEY> \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "method": "web3_clientVersion", "params": [], "id": 1}'

```

```
{"jsonrpc": "2.0", "id": 1, "result": "Geth/v1.10.8-omnibus-aef5bfb3/linux-amd64/go1.16.7"}

```

To ensure that the reverse proxy is working, execute the same request, replacing `localhost` with `sepolia.infura.io`. You should get the same result:

- Example curl HTTPS request
- Example JS result

```
curl https://sepolia.infura.io/v3/<YOUR-API-KEY> \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "method": "web3_clientVersion", "params": [], "id": 1}'

```

```
{"jsonrpc": "2.0", "id": 1, "result": "Geth/v1.10.8-omnibus-aef5bfb3/linux-amd64/go1.16.7"}

```
