# Asterisk WebSocket - Nginx Reverse Proxy

**URL:** <https://community.asterisk.org/t/asterisk-websocket-nginx-reverse-proxy/101286>\
**Category:** Asterisk Support\
**Created:** [March 1, 2024, 2:42pm UTC](https://community.asterisk.org/t/asterisk-websocket-nginx-reverse-proxy/101286 "2024-03-01T14:42:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![idan.ih2](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/idan.ih2/32/9417_2.png) [@idan.ih2](https://community.asterisk.org/u/idan.ih2)\
**Post date:** [March 1, 2024, 2:42pm UTC](https://community.asterisk.org/t/asterisk-websocket-nginx-reverse-proxy/101286/1 "2024-03-01T14:42:35Z")

</div>

Dear Asterisk community,

I am using Asterisk 11.25.3 and configured nginx as a reverse proxy to the asterisk web socket.

I configured the asterisk mini http to listen on port 8080,  
requests to port 443 to this location /ws,  
will be forwarded to the asterisk web socket, here is the nginx config:

location = /ws {  
proxy\_pass [https://127.0.0.1:8080/ws](https://127.0.0.1:8080/ws);  
proxy\_http\_version 1.1;  
proxy\_set\_header Upgrade $http\_upgrade;  
proxy\_set\_header Connection “upgrade”;  
proxy\_set\_header Host $host;  
proxy\_set\_header X-Real-IP $remote\_addr;  
proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;  
proxy\_set\_header X-Forwarded-Proto $scheme;  
proxy\_read\_timeout 86400;  
proxy\_send\_timeout 86400;  
}

The issue I’m having is that I’m not able to see the client IP when doing sip show peers,  
the IP that is see it the localhost IP - 127.0.0.1.

I was wondering if there is a header that the asterisk read on the registration so the IP of the client will be the one that registered with the extension instead of the localhost.

Your kind help will be appreciated.

Thanks in advance,  
Idan

---

<div class="post-metadata">

**Author:** ![jcolp](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/jcolp/32/8848_2.png) [@jcolp](https://community.asterisk.org/u/jcolp)\
**Post date:** [March 1, 2024, 2:48pm UTC](https://community.asterisk.org/t/asterisk-websocket-nginx-reverse-proxy/101286/2 "2024-03-01T14:48:49Z")

</div>

There is not. It does not read any headers such as X-Real-IP and present it.

---

<div class="post-metadata">

**Author:** ![idan.ih2](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/idan.ih2/32/9417_2.png) [@idan.ih2](https://community.asterisk.org/u/idan.ih2)\
**Post date:** [March 1, 2024, 3:12pm UTC](https://community.asterisk.org/t/asterisk-websocket-nginx-reverse-proxy/101286/3 "2024-03-01T15:12:16Z")

</div>

Thank you!

What about Asterisk 18.20.1? the headers supported on that version?

---

<div class="post-metadata">

**Author:** ![jcolp](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/jcolp/32/8848_2.png) [@jcolp](https://community.asterisk.org/u/jcolp)\
**Post date:** [March 1, 2024, 3:13pm UTC](https://community.asterisk.org/t/asterisk-websocket-nginx-reverse-proxy/101286/4 "2024-03-01T15:13:18Z")

</div>

No, no version currently supports such a thing.

---

<div class="post-metadata">

**Author:** ![david551](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@david551](https://community.asterisk.org/u/david551)\
**Post date:** [March 1, 2024, 3:14pm UTC](https://community.asterisk.org/t/asterisk-websocket-nginx-reverse-proxy/101286/5 "2024-03-01T15:14:06Z")

</div>

X- in front of a header means it has no official meaning. It’s used for custom headers where both sender and receiver have made a private agreement.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/asterisk/original/2X/4/475d0c889911cfb84ac4881ad6df8b523e3f9105.png) [@system](https://community.asterisk.org/u/system)\
**Post date:** [March 31, 2024, 3:14pm UTC](https://community.asterisk.org/t/asterisk-websocket-nginx-reverse-proxy/101286/6 "2024-03-31T15:14:52Z")

</div>

Closed on March 31, 2024, 3:14pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
