How to add x-forwarded-for in UDP load balancer
September 08, 2022 11:46AM
I created a udp syslog load balancer. I'm trying to get the actual IP address of host in the log, instead of load balancer IP.
I tried below settings but I get an error "set_ip directive is not allowed here" etc.
where should I add the x-forwarded-for, or set_ip directive....etc???
Thanks in advance.

worker_rlimit_nofile 10000;

events {
worker_connections 100;

stream {
server {
listen 514 udp;
location / {
proxy_pass backend;
proxy_responses 0;
set_real_ip_from 10.xx.xx.xx/26
real_ip_header X-Forwarded-For;

# server {
# listen 514;
# proxy_pass backend_tcp;
# proxy_responses 0;
# }

upstream backend {
server 10.xx.xx.xx:514;
server 10.xx.xx.xx:514;
server 10.xx.xx.xx:514;

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 113
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready