apiVersion: v1
kind: ConfigMap
metadata:
  name: front-door-lock-nginx-conf
data:
  nginx.conf: |
    error_log /dev/stderr;
    pid /dev/null;
    events {
      worker_connections 64;
    }
    http {
      log_format main '[$time_local] code=$status bytes_sent=$bytes_sent req="$request"';
      proxy_headers_hash_bucket_size 128;
      proxy_buffering off;
      server {
        # access_log /dev/stderr main;
        access_log off;

        location = /metrics {
          proxy_pass http://127.0.0.1:8001/metrics;
        }
        location = /health {
          proxy_pass http://127.0.0.1:8001/health;
        }
        location = /front-door-lock/metrics {
          proxy_pass http://127.0.0.1:8001/metrics;
        }
        location /front-door-lock/api/ {
          proxy_pass http://127.0.0.1:8001/api/;
        }

        location = /front-door-lock/vite-ws {
          proxy_pass http://127.0.0.1:8002/front-door-lock/vite-ws;
          proxy_http_version 1.1;
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection "Upgrade";
        }

        location /front-door-lock/ {
          proxy_pass http://127.0.0.1:8002/front-door-lock/;
        }
      }
    }
