fix(infra): use ^~ prefix location for /api and /ws to match without trailing slash

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
MythEclipse
2026-06-02 08:51:57 +07:00
co-authored by Claude Opus 4.8
parent 2b8d1ac703
commit cbe63809dd
+4 -4
View File
@@ -15,8 +15,8 @@ server {
listen 80; listen 80;
server_name imphnen.asepharyana.my.id; server_name imphnen.asepharyana.my.id;
# API proxy # API proxy — matches /api and /api/*
location /api/ { location ^~ /api {
proxy_pass http://backend; proxy_pass http://backend;
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;
@@ -24,8 +24,8 @@ server {
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
} }
# WebSocket proxy # WebSocket proxy — matches /ws and /ws/*
location /ws { location ^~ /ws {
proxy_pass http://backend; proxy_pass http://backend;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;