From 40d2bf4a27a62dab391e8043666cd1edc4ebb388 Mon Sep 17 00:00:00 2001 From: Cipher Vance Date: Sat, 22 Nov 2025 22:15:27 -0600 Subject: [PATCH] fix nginx.conf --- docker/nginx.conf | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/docker/nginx.conf b/docker/nginx.conf index 7041e3a..1c15ee1 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -25,6 +25,32 @@ server { add_header Cache-Control "no-cache, no-store, must-revalidate"; } + # API proxy + location /api/ { + proxy_pass https://dev-api.rideaware.org; + proxy_http_version 1.1; + proxy_set_header Host dev-api.rideaware.org; + 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_set_header X-Forwarded-Host $host; + proxy_cache_bypass $http_upgrade; + + # CORS headers + add_header 'Access-Control-Allow-Origin' '*' always; + add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always; + add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization' always; + + if ($request_method = 'OPTIONS') { + add_header 'Access-Control-Allow-Origin' '*'; + add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS'; + add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization'; + add_header 'Content-Type' 'text/plain charset=UTF-8'; + add_header 'Content-Length' 0; + return 204; + } + } + # SPA - route all requests to index.html location / { try_files $uri $uri/ /index.html;