# app.dev.lernschiff.com — Livewire SPA + Vite assets server { listen 80; server_name app.dev.lernschiff.com; root /var/www/html/public; index index.php; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ \.php$ { fastcgi_pass app:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location /storage { alias /var/www/html/storage/app/public; } } # api.dev.lernschiff.com — Laravel JSON API + CORS (Single-Source-of-Truth) server { listen 80; server_name api.dev.lernschiff.com; root /var/www/html/public; index index.php; # OPTIONS Preflight fast-path location / { if ($request_method = OPTIONS) { add_header Access-Control-Allow-Origin "https://app.dev.lernschiff.com" always; add_header Access-Control-Allow-Methods "GET, POST, PUT, PATCH, DELETE, OPTIONS" always; add_header Access-Control-Allow-Headers "Content-Type, Authorization, X-XSRF-TOKEN, X-Requested-With" always; add_header Access-Control-Allow-Credentials "true" always; add_header Access-Control-Max-Age 86400 always; add_header Content-Length 0; return 204; } add_header Access-Control-Allow-Origin "https://app.dev.lernschiff.com" always; add_header Access-Control-Allow-Credentials "true" always; try_files $uri $uri/ /index.php?$query_string; } location ~ \.php$ { fastcgi_pass app:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }