# How do I get the real IP address of the connected node in my Radix logs when using an nginx reverse proxy?

**URL:** <https://radixtalk.com/t/how-do-i-get-the-real-ip-address-of-the-connected-node-in-my-radix-logs-when-using-an-nginx-reverse-proxy/243>\
**Category:** Validators\
**Tags:** howto, nginx, validators\
**Created:** [15 January 2022 11:17 UTC](https://radixtalk.com/t/how-do-i-get-the-real-ip-address-of-the-connected-node-in-my-radix-logs-when-using-an-nginx-reverse-proxy/243 "2022-01-15T11:17:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stuart](https://radixtalk.com/letter_avatar_proxy/v4/letter/s/cab0a1/32.png) [@Stuart](https://radixtalk.com/u/Stuart)\
**Post date:** [15 January 2022 11:17 UTC](https://radixtalk.com/t/how-do-i-get-the-real-ip-address-of-the-connected-node-in-my-radix-logs-when-using-an-nginx-reverse-proxy/243/1 "2022-01-15T11:17:46Z")

</div>

If you have an Nginx reverse proxy in front of your Radix node then the Radix log file will show connections from `127.0.0.1` instead of the real IP address of the node you are connected to.

For example:

```auto
Auth handshake failed on {-> ?@127.0.0.1:57872 | AUTH_HANDSHAKE}: Handshake decryption failed (Invalid MAC)

```

After enabling the Proxy Protocol you will see the real ip logged:

```auto
Auth handshake failed on {-> ?@164.132.201.13:51752 | AUTH_HANDSHAKE}: Handshake decryption failed (Invalid MAC)

```

## 1. Enable the Proxy Protocol in your Radix configuration

Add the following line to the `default.config` files:

```auto
network.p2p.use_proxy_protocol=true

```

## 2. Enable the Proxy Protocol in your Nginx configuration

Edit the `nginx.conf` file (usually found in `/etc/nginx`) and change the server block near the top of the file from:

```plaintext
  server {
    listen 30000;
    proxy_pass 127.0.0.1:30001;
  }

```

to

```plaintext
  server {
    listen 30000 proxy_protocol;
    proxy_protocol on;
    proxy_pass 127.0.0.1:30001;
  }

```

**Note:** You may have different ports numbers/ip address in your configuration. Don’t change these details - just append the `proxy_protocol` directive to the `listen` line and add the new `proxy_protocol on;` line.

After making these changes, ensure your nginx configuration file is valid by running:

```auto
sudo nginx -t

# nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
# nginx: configuration file /etc/nginx/nginx.conf test is successful

```

## 3. Apply the Changes

You need to apply the changes at about the same time otherwise Radix will throw lots of exceptions.

```bash
sudo systemctl reload nginx
sudo systemctl restart radixdlt-node

```

---

<div class="post-metadata">

**Author:** ![radixlogicalmoon](https://radixtalk.com/user_avatar/radixtalk.com/radixlogicalmoon/32/156_2.png) [@radixlogicalmoon](https://radixtalk.com/u/radixlogicalmoon)\
**Post date:** [24 July 2022 11:36 UTC](https://radixtalk.com/t/how-do-i-get-the-real-ip-address-of-the-connected-node-in-my-radix-logs-when-using-an-nginx-reverse-proxy/243/2 "2022-07-24T11:36:00Z")

</div>

Not sure if this has just changed since the original post, but I only had to edit the file as below

1. Run this command to edit the file if running System D

```auto
# In the latest version of NGINX it in this file (which is included into nginx.conf)
sudo nano /etc/nginx/conf.d/coretcpserver.conf

# In older versions it was here
sudo nano /etc/nginx/nginx.conf

```

1. Edit the file

```auto
 server {
        listen 30000;
        proxy_protocol on;
        proxy_pass 127.0.0.1:30001;

    }

```

1. And to apply the changes I ran

```auto
sudo systemctl restart nginx

```

And to check all was working as expected I ran the Get Peers API and check to see records in the response had an “IN” value

---

<div class="post-metadata">

**Author:** ![Stuart](https://radixtalk.com/letter_avatar_proxy/v4/letter/s/cab0a1/32.png) [@Stuart](https://radixtalk.com/u/Stuart)\
**Post date:** [25 July 2022 08:04 UTC](https://radixtalk.com/t/how-do-i-get-the-real-ip-address-of-the-connected-node-in-my-radix-logs-when-using-an-nginx-reverse-proxy/243/3 "2022-07-25T08:04:39Z")

</div>

Thanks for the feedback. It’s been a while since I looked at this.

Did you also have to set the `network.p2p.use_proxy_protocol=true` in the `default.config`?

---

<div class="post-metadata">

**Author:** ![radixlogicalmoon](https://radixtalk.com/user_avatar/radixtalk.com/radixlogicalmoon/32/156_2.png) [@radixlogicalmoon](https://radixtalk.com/u/radixlogicalmoon)\
**Post date:** [25 July 2022 22:37 UTC](https://radixtalk.com/t/how-do-i-get-the-real-ip-address-of-the-connected-node-in-my-radix-logs-when-using-an-nginx-reverse-proxy/243/4 "2022-07-25T22:37:36Z")

</div>

Yes I had to change that and also ensure the listen port and api port are set correctly

```auto
network.p2p.use_proxy_protocol=true
network.p2p.listen_port=30001
api.port=3334

```

---

<div class="post-metadata">

**Author:** ![RoterHund](https://radixtalk.com/user_avatar/radixtalk.com/roterhund/32/1733_2.png) [@RoterHund](https://radixtalk.com/u/RoterHund)\
**Post date:** [5 November 2023 14:24 UTC](https://radixtalk.com/t/how-do-i-get-the-real-ip-address-of-the-connected-node-in-my-radix-logs-when-using-an-nginx-reverse-proxy/243/5 "2023-11-05T14:24:21Z")

</div>

On this ‘listen 30000’ setting, should it be version A or B below?

A.  
server {  
listen 30000 **proxy\_protocol** ;  
proxy\_protocol on;  
proxy\_pass 127.0.0.1:30001;  
}

or B.  
server {  
listen 30000;  
proxy\_protocol on;  
proxy\_pass 127.0.0.1:30001;  
}

or does it matter?  
Reason I ask is I suspect when I use A) the Stakesafe dashboard reports ‘Not Accepting Connections’.
