Asterisk WebSocket - Nginx Reverse Proxy

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;
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

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

Thank you!

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

No, no version currently supports such a thing.

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.

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