From cbe63809ddf678bee31fdfbaf0f9de9962287175 Mon Sep 17 00:00:00 2001 From: MythEclipse Date: Tue, 2 Jun 2026 08:51:57 +0700 Subject: [PATCH] fix(infra): use ^~ prefix location for /api and /ws to match without trailing slash Co-Authored-By: Claude Opus 4.8 --- infra/docker/nginx/nginx.conf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/infra/docker/nginx/nginx.conf b/infra/docker/nginx/nginx.conf index 564625b..4f6fe12 100644 --- a/infra/docker/nginx/nginx.conf +++ b/infra/docker/nginx/nginx.conf @@ -15,8 +15,8 @@ server { listen 80; server_name imphnen.asepharyana.my.id; - # API proxy - location /api/ { + # API proxy — matches /api and /api/* + location ^~ /api { proxy_pass http://backend; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; @@ -24,8 +24,8 @@ server { proxy_set_header X-Forwarded-Proto $scheme; } - # WebSocket proxy - location /ws { + # WebSocket proxy — matches /ws and /ws/* + location ^~ /ws { proxy_pass http://backend; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade;