server {
    listen 80;
    server_name localhost;
    resolver 127.0.0.11 valid=10s ipv6=off;
    root /usr/share/nginx/html;
    index index.html;

    client_max_body_size 100M;

    location /api/ {
        set $upstream http://tkeg-api:8000;
        rewrite ^/api/(.*)$ /$1 break;
        proxy_pass $upstream;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_request_buffering off;
        client_max_body_size 100M;
    }

    location / {
        try_files $uri $uri/ /index.html;
    }

    location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
        expires 1y;
        add_header Cache-Control "public, immutable";
    }
}
