diff --git a/nginx/conf.d/prod.conf b/nginx/conf.d/prod.conf index 314b3e38..d44e6d45 100644 --- a/nginx/conf.d/prod.conf +++ b/nginx/conf.d/prod.conf @@ -2,6 +2,17 @@ server { listen 80; server_name cockple.store; + location /ws/ { + proxy_pass http://cockple-app:8080; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + 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 $http_x_forwarded_proto; + } + location / { proxy_pass http://cockple-app:8080; proxy_set_header Host $host; diff --git a/nginx/conf.d/staging.conf b/nginx/conf.d/staging.conf index 2a222c17..e050fc27 100644 --- a/nginx/conf.d/staging.conf +++ b/nginx/conf.d/staging.conf @@ -2,6 +2,17 @@ server { listen 80; server_name staging.cockple.store; + location /ws/ { + proxy_pass http://cockple-app-staging:8080; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + 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 $http_x_forwarded_proto; + } + location / { proxy_pass http://cockple-app-staging:8080; proxy_set_header Host $host; diff --git a/src/main/java/umc/cockple/demo/global/config/WebSocketConfig.java b/src/main/java/umc/cockple/demo/global/config/WebSocketConfig.java index 8efc432a..aea6747b 100644 --- a/src/main/java/umc/cockple/demo/global/config/WebSocketConfig.java +++ b/src/main/java/umc/cockple/demo/global/config/WebSocketConfig.java @@ -21,7 +21,7 @@ public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { registry .addHandler(chatWebSocketHandler, "/ws/chats") .addInterceptors(jwtWebSocketAuthInterceptor) - .setAllowedOrigins("http://localhost:5173", "https://cockple.store", "https://cockple-fe.vercel.app/") + .setAllowedOrigins("http://localhost:5173", "https://cockple.store", "https://cockple-fe.vercel.app/", "https://staging.cockple.store") .withSockJS(); // 브라우저 호환성 } }