title: Can Nginx duplicate TCP/UDP traffic?
body: <p>Below is my nginx.conf file, I have two upstreams, http_upstream and tcp_upstream, I make duplicated HTTP traffic and send it to load-balancer2.example.com:80 by using post_action, now I am wondering if I could make duplicated TCP/UDP traffic by using something similar to post_action?</p>
  
  <pre><code>daemon on;
  user  root;
  worker_processes  auto;
  
  error_log  /var/log/nginx/error.log warn;
  pid        /var/run/nginx.pid;
  
  
  events {
      worker_connections  1024;
  }
  
  stream {
      upstream tcp_upstream {
          server server1.example.com:2000;
          server server2.example.com:2000;
          server server3.example.com:2000;
  
      }
      server {
          listen 2000;
          proxy_pass tcp_upstream;
      }
  }
  
  
  http {
      include       /etc/nginx/mime.types;
      default_type  application/octet-stream;
  
      log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                        '$status $body_bytes_sent "$http_referer" '
                        '"$http_user_agent" "$http_x_forwarded_for"';
  
      access_log  /var/log/nginx/access.log  main;
  
      sendfile        on;
      #tcp_nopush     on;
  
      keepalive_timeout  65;
  
      #gzip  on;
  
      client_header_buffer_size   512k;
      large_client_header_buffers 4   512k;
      client_max_body_size 1000M;
      client_body_buffer_size 1000M;
  
      upstream http_upstream {
          server server1.example.com:8088;
          server server2.example.com:8088;
          server server3.example.com:8088;
      }
      server {
          listen 80;
          location / {
              proxy_pass http://http_upstream/;
              post_action @post_action;
          }
          location @post_action {
              proxy_pass http://load-balancer2.example.com:80;
          }
  
      }
  
      include /etc/nginx/conf.d/*.conf;
  }
  </code></pre>