I have an Nginx config that looks like:
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
stream {
log_format basic '$remote_addr [$time_local] '
'$protocol $status $bytes_sent $bytes_received '
'$session_time';
server {
listen 1194 udp reuseport;
access_log /var/log/nginx/stream-access.log basic;
proxy_pass vpn;
proxy_bind $remote_addr transparent;
proxy_responses 0;
proxy_timeout 1s;
}
server {
listen 1195 udp;
return "data";
}
upstream vpn {
server 127.0.0.1:1195;
}
}
And I can send and receive data on port 1195, like so:
$ echo -n "hello" | nc -4u -w1 127.0.0.1 1195
data
But if I try to use the proxy and sent to port 1194 I dont get any data back.
$ echo -n "hello" | nc -4u -w1 127.0.0.1 1194
Might anyone know why?
Also this is what the log look like:
127.0.0.1 [26/Apr/2024:16:38:52 +0000] UDP 200 0 5 0.000
I do think I figured it out. The directive proxy_responses 0;
does not expect or return any answers, so I removed it and it worked as expected.
I was trying to tunnel my Wireguard (DNS) VPN through Nginx but could not get it to work as expected so I gave up.