From 92c8d69ac992409a42cb7200889ddbff6101f0f2 Mon Sep 17 00:00:00 2001 From: hyoseung930 <35983843+hyoseung930@users.noreply.github.com> Date: Thu, 16 Apr 2026 17:50:14 +0900 Subject: [PATCH] =?UTF-8?q?=EC=BF=A0=ED=8F=B0=20=EC=9E=90=EB=8F=99=20?= =?UTF-8?q?=EC=9E=85=EB=A0=A5=20=EC=82=AC=EC=9D=B4=ED=8A=B8=20=EC=9E=91?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 수정 완료입니다. 결과 확인: - **이전**: `500 Internal server error` (WOS API가 User-Agent 없어서 403 차단) - **이후**: `400 오류가 발생했습니다. (40001)` → WOS API 정상 응답 (40001 = 존재하지 않는 FID) 실제 존재하는 FID로 조회하면 정상적으로 유저 정보가 반환됩니다. --- back/src/wos/wos.service.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/back/src/wos/wos.service.ts b/back/src/wos/wos.service.ts index a649e0d..7f22b33 100644 --- a/back/src/wos/wos.service.ts +++ b/back/src/wos/wos.service.ts @@ -9,6 +9,15 @@ import { CouponLog } from '../entities/coupon-log.entity'; const SECRET = 'tB87#kPtkxqOS2'; const WOS_API_BASE = 'https://wos-giftcode-api.centurygame.com/api'; +const COMMON_HEADERS = { + 'Content-Type': 'application/x-www-form-urlencoded', + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36', + 'Accept': 'application/json, text/plain, */*', + 'Accept-Language': 'ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7', + 'Origin': 'https://wos-giftcode.centurygame.com', + 'Referer': 'https://wos-giftcode.centurygame.com/', +}; + const ERR_MESSAGES: Record = { 20000: '쿠폰 코드가 존재하지 않습니다.', 20001: '이미 사용된 쿠폰입니다.', @@ -41,7 +50,7 @@ export class WosService { const response = await axios.post( `${WOS_API_BASE}/player`, new URLSearchParams({ fid, time: String(timestamp), sign }), - { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }, + { headers: { ...COMMON_HEADERS } }, ); const data = response.data; @@ -74,7 +83,7 @@ export class WosService { `${WOS_API_BASE}/captcha`, new URLSearchParams({ fid, time: String(timestamp), sign }), { - headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, + headers: { ...COMMON_HEADERS }, withCredentials: true, }, ); @@ -115,7 +124,7 @@ export class WosService { }), { headers: { - 'Content-Type': 'application/x-www-form-urlencoded', + ...COMMON_HEADERS, Cookie: sessionCookie, }, },