Files
thebet365/docker/nginx/admin.conf
Mars b0062ddf39 fix(admin): resolve Nginx redirect loop with alias and named location
Use alias to strip /admin/ prefix for file lookups and @admin_spa
named location for SPA fallback, preventing internal redirect cycle.

🤖 Generated with [Qoder][https://qoder.com]
2026-06-09 09:42:58 +08:00

34 lines
806 B
Plaintext

server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
resolver 127.0.0.11 valid=10s ipv6=off;
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml;
location /admin/api/ {
proxy_pass http://api:3000/api/;
proxy_http_version 1.1;
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;
}
location /admin/ {
alias /usr/share/nginx/html/;
try_files $uri $uri/ @admin_spa;
}
location @admin_spa {
rewrite ^ /index.html break;
}
location = / {
return 301 /admin/;
}
}