fix: nginx SPA 라우팅 403 에러 수정
All checks were successful
Deploy Nginx Config to Ubuntu Server / deploy (push) Successful in 2s
All checks were successful
Deploy Nginx Config to Ubuntu Server / deploy (push) Successful in 2s
문제: - /goosefarm/assets/ 접근 시 403 Forbidden 발생 - try_files의 /가 디렉토리 인덱싱 시도 해결: - try_files에서 / 제거 - 파일 없으면 바로 index.html로 fallback하여 React Router가 라우팅 처리 변경: try_files $uri $uri/ /goosefarm/index.html; → try_files $uri /goosefarm/index.html;
This commit is contained in:
parent
1aeab94dcf
commit
950cb6da5d
@ -51,17 +51,24 @@ server {
|
|||||||
try_files $uri $uri/ /index.html;
|
try_files $uri $uri/ /index.html;
|
||||||
}
|
}
|
||||||
|
|
||||||
# GooseFarm Frontend
|
# GooseFarm API - must come before /goosefarm for priority
|
||||||
location /goosefarm {
|
location /goosefarm/api/ {
|
||||||
proxy_pass http://localhost:3001;
|
proxy_buffering on;
|
||||||
proxy_http_version 1.1;
|
proxy_buffer_size 128k;
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_buffers 8 256k;
|
||||||
proxy_set_header Connection 'upgrade';
|
proxy_busy_buffers_size 512k;
|
||||||
|
proxy_read_timeout 120s;
|
||||||
|
proxy_pass http://localhost:8200/api/;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
proxy_cache_bypass $http_upgrade;
|
}
|
||||||
|
|
||||||
|
# GooseFarm Frontend
|
||||||
|
location /goosefarm {
|
||||||
|
alias /var/www/html/goosefarm/;
|
||||||
|
try_files $uri /goosefarm/index.html;
|
||||||
}
|
}
|
||||||
|
|
||||||
# API endpoints -> route to gateway (host 8100 -> container 8000)
|
# API endpoints -> route to gateway (host 8100 -> container 8000)
|
||||||
@ -173,17 +180,24 @@ server {
|
|||||||
try_files $uri $uri/ /index.html;
|
try_files $uri $uri/ /index.html;
|
||||||
}
|
}
|
||||||
|
|
||||||
# GooseFarm Frontend
|
# GooseFarm API - must come before /goosefarm for priority
|
||||||
location /goosefarm {
|
location /goosefarm/api/ {
|
||||||
proxy_pass http://localhost:3001;
|
proxy_buffering on;
|
||||||
proxy_http_version 1.1;
|
proxy_buffer_size 128k;
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_buffers 8 256k;
|
||||||
proxy_set_header Connection 'upgrade';
|
proxy_busy_buffers_size 512k;
|
||||||
|
proxy_read_timeout 120s;
|
||||||
|
proxy_pass http://localhost:8200/api/;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
proxy_cache_bypass $http_upgrade;
|
}
|
||||||
|
|
||||||
|
# GooseFarm Frontend
|
||||||
|
location /goosefarm {
|
||||||
|
alias /var/www/html/goosefarm/;
|
||||||
|
try_files $uri /goosefarm/index.html;
|
||||||
}
|
}
|
||||||
|
|
||||||
# API endpoints -> route to gateway (host 8100 -> container 8000)
|
# API endpoints -> route to gateway (host 8100 -> container 8000)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user