diff --git a/public/index.html b/public/index.html
index 7c25b2f..afb3c85 100644
--- a/public/index.html
+++ b/public/index.html
@@ -884,7 +884,7 @@ curl -X DELETE http://localhost:5577/api/users/user005 \
diff --git a/public/js/app.js b/public/js/app.js
index f899390..f24fe31 100644
--- a/public/js/app.js
+++ b/public/js/app.js
@@ -12,6 +12,9 @@ document.addEventListener('DOMContentLoaded', function() {
function initializeApp() {
hideLoading();
+ // 동적으로 현재 서버 주소 설정
+ updateBaseUrl();
+
// 저장된 토큰 확인
const savedToken = localStorage.getItem('authToken');
if (savedToken) {
@@ -25,6 +28,21 @@ function initializeApp() {
setupEventListeners();
}
+// 현재 접속한 서버 주소로 Base URL 업데이트
+function updateBaseUrl() {
+ const currentHost = window.location.host; // 현재 호스트:포트
+ const currentProtocol = window.location.protocol; // http: 또는 https:
+ const baseUrl = `${currentProtocol}//${currentHost}`;
+
+ // API 테스터의 Base URL 업데이트
+ const baseUrlElement = document.getElementById('baseUrl');
+ if (baseUrlElement) {
+ baseUrlElement.textContent = baseUrl;
+ }
+
+ console.log('Base URL 설정:', baseUrl);
+}
+
// 이벤트 리스너 설정
function setupEventListeners() {
// 로그인 폼
@@ -1222,7 +1240,9 @@ async function sendApiRequest() {
return;
}
- const fullUrl = `http://localhost:5577${url}`;
+ // 동적으로 현재 서버 주소 사용
+ const baseUrl = `${window.location.protocol}//${window.location.host}`;
+ const fullUrl = `${baseUrl}${url}`;
const startTime = Date.now();
try {