Streams from specific IP only #5518
Replies: 2 comments
|
Yes. Nginx’s stream access module supports If the restriction should apply to every TCP stream, create this file in NPM’s persistent data volume: # /data/nginx/custom/server_stream_tcp.conf
allow 203.0.113.25;
allow 198.51.100.0/24;
deny all;For UDP streams, use: # /data/nginx/custom/server_stream_udp.conf
allow 203.0.113.25;
deny all;Then validate and reload the configuration: docker exec <npm-container> nginx -t
docker exec <npm-container> nginx -s reloadImportant caveat: NPM includes these files in every TCP or UDP stream server block. Therefore, this method is unsuitable if you have several streams and only one of them should use that allow-list. For a restriction on one specific stream, the cleaner option is to allow the source IP on the host firewall/router for that stream’s published port and reject other sources there. That also drops unwanted traffic before it reaches Nginx. I would avoid editing |
|
NGINX itself supports this for TCP/UDP streams through the A native Nginx stream configuration can do: server {
listen 12345;
allow 192.168.1.100;
# or a subnet:
# allow 192.168.1.0/24;
deny all;
proxy_pass backend:12345;
}The rules are evaluated against the source IP and the first matching rule wins. The limitation is Nginx Proxy Manager: currently its Stream Host UI does not expose So with NPM today I would use one of these:
For a single source IP, a host firewall rule is probably the simplest and most robust solution. I would not manually edit an NPM-generated stream configuration because NPM may regenerate and overwrite it later. |
Uh oh!
There was an error while loading. Please reload this page.
Is it possible to setup Streams only from specific source ip-address?
All reactions