diff --git a/nginx/conf.d/nginx.conf b/nginx/conf.d/nginx.conf index 3903a64..5762757 100644 --- a/nginx/conf.d/nginx.conf +++ b/nginx/conf.d/nginx.conf @@ -31,10 +31,12 @@ server { } # 모든 요청에 대해 CORS 헤더 추가 - add_header 'Access-Control-Allow-Origin' "$http_origin" always; - add_header 'Access-Control-Allow-Methods' 'GET, PUT, POST, DELETE, PATCH, OPTIONS' always; - add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization' always; - add_header 'Access-Control-Allow-Credentials' 'true' always; + if ($http_origin ~* (https?://(localhost:5173|api\.findynow\.com|findynow\.com))) { + add_header 'Access-Control-Allow-Origin' "$http_origin" always; + add_header 'Access-Control-Allow-Methods' 'GET, PUT, POST, DELETE, PATCH, OPTIONS' always; + add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization' always; + add_header 'Access-Control-Allow-Credentials' 'true' always; + } # Spring 애플리케이션으로 프록시 proxy_pass http://findy-app:8080;