server { listen 80; # Serve Vue frontend location / { root /usr/share/nginx/html; index index.html; try_files $uri /index.html; } # Reverse proxy for API requests location /search { proxy_pass https://192.168.99.121/search; # Backend API address proxy_ssl_verify off; 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; # CORS headers add_header 'Access-Control-Allow-Origin' '*' always; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE' always; add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type' always; # Handle preflight OPTIONS requests if ($request_method = OPTIONS) { return 204; } } }