server { listen 80; server_name localhost; root /usr/share/nginx/html; index index.html; # auth_request subrequest inherits this: must fit large AI/OCR image bodies client_max_body_size 60m; # ---- license gate (server-side enforcement via auth_request) ---- location = /_license { internal; proxy_pass http://it-tools-relay:8091/check; proxy_set_header X-Machine-Id $http_x_machine_id; proxy_set_header X-Tool $http_x_tool; proxy_connect_timeout 5s; proxy_read_timeout 10s; } # license relay (card activation etc; auth gate itself must stay open) location /relay/ { client_max_body_size 110m; proxy_pass http://it-tools-relay:8091/; proxy_connect_timeout 5s; proxy_read_timeout 300s; } # AI retouch (iopaint container on host) - protected location /api/v1/ { auth_request /_license; client_max_body_size 60m; proxy_pass http://host.docker.internal:8060/api/v1/; proxy_connect_timeout 10s; proxy_read_timeout 300s; } # OCR service (rapidocr container on host) - protected location = /api/ocr { auth_request /_license; client_max_body_size 30m; proxy_pass http://host.docker.internal:5000/ocr; proxy_connect_timeout 10s; proxy_read_timeout 120s; } # Google translate via relay container (host proxy required in CN) - protected location = /api/translate { auth_request /_license; proxy_pass http://it-tools-relay:8091/translate; proxy_connect_timeout 10s; proxy_read_timeout 30s; } # MyMemory fallback translation - protected location = /api/translate-mm { auth_request /_license; proxy_pass https://api.mymemory.translated.net/get; proxy_ssl_server_name on; proxy_set_header Host api.mymemory.translated.net; proxy_connect_timeout 10s; proxy_read_timeout 30s; } location / { try_files $uri $uri/ /index.html; } }