nginx.conf 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. worker_processes 1;
  2. events { worker_connections 1024; }
  3. http {
  4. # Real client IP: edge Caddy edastab X-Forwarded-For. Usalda tailneti (100.64.0.0/10)
  5. # ja edge'i avalikku IP-d; real_ip_recursive off -> võetakse XFF-i viimane (päris klient).
  6. set_real_ip_from 100.64.0.0/10;
  7. set_real_ip_from 188.166.84.16;
  8. real_ip_header X-Forwarded-For;
  9. real_ip_recursive off;
  10. # Rate-limit: 20 päringut/s IP kohta, puhverdus 60 (nodelay = kohe).
  11. limit_req_zone $binary_remote_addr zone=otlp:10m rate=20r/s;
  12. limit_req_status 429;
  13. limit_conn_zone $binary_remote_addr zone=otlpconn:10m;
  14. log_format main '$remote_addr "$request" $status';
  15. access_log /dev/stdout main;
  16. upstream collector { server clickstack:4318; }
  17. server {
  18. listen 4319;
  19. location / {
  20. limit_req zone=otlp burst=60 nodelay;
  21. limit_conn otlpconn 40;
  22. proxy_pass http://collector;
  23. proxy_http_version 1.1;
  24. proxy_set_header Host $host;
  25. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  26. proxy_set_header Authorization $http_authorization;
  27. proxy_request_buffering off;
  28. proxy_read_timeout 60s;
  29. client_max_body_size 10m;
  30. }
  31. }
  32. }