From 9633f7644e1d5b50a12a1c5cb28de88ad9f6e8df Mon Sep 17 00:00:00 2001 From: kuaifan Date: Fri, 18 Jul 2025 13:20:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E5=BA=A6=E5=8F=B3=E9=94=AE=E5=A4=8D=E5=88=B6=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/nginx/default.conf | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docker/nginx/default.conf b/docker/nginx/default.conf index 1b9cdfc51..2591086ac 100644 --- a/docker/nginx/default.conf +++ b/docker/nginx/default.conf @@ -38,6 +38,26 @@ server { try_files $uri @laravels; } + location ~* \.(jpe?g|png|gif|webp|svg|ico|bmp)$ { + add_header Access-Control-Allow-Origin "http://localhost:2222" always; + add_header Access-Control-Allow-Methods "GET, OPTIONS" always; + add_header Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization" always; + add_header Access-Control-Allow-Credentials "true" always; + + if ($request_method = 'OPTIONS') { + add_header Access-Control-Allow-Origin "http://localhost:2222"; + add_header Access-Control-Allow-Methods "GET, OPTIONS"; + add_header Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization"; + add_header Access-Control-Allow-Credentials "true"; + add_header Access-Control-Max-Age 1728000; + add_header Content-Type "text/plain; charset=utf-8"; + add_header Content-Length 0; + return 204; + } + + try_files $uri @laravels; + } + location ~ \.well-known{ allow all; }