[#28] 쿠버네티스 환경 배포 #29

Merged
pricelees merged 25 commits from infra/#28 into main 2025-08-04 05:59:38 +00:00
6 changed files with 17 additions and 27 deletions
Showing only changes of commit 7a79ad68d6 - Show all commits

View File

@ -1 +1 @@
VITE_API_BASE_URL = "http://localhost:8080"
VITE_API_BASE_URL = '/api'

View File

@ -1,7 +1,7 @@
import axios, { type AxiosError, type AxiosRequestConfig, type Method } from 'axios';
const apiClient = axios.create({
baseURL: import.meta.env.VITE_API_BASE_URL || 'http://localhost:8080',
baseURL: import.meta.env.VITE_API_BASE_URL || '/api',
timeout: 10000,
});

View File

@ -8,4 +8,19 @@ export default defineConfig({
react(),
tsconfigPaths(),
],
server: {
proxy: {
'/api': {
// 실제 백엔드 서버 주소로 전달
target: 'http://localhost:8080',
// Origin 헤더를 target의 Origin으로 변경 (CORS 에러 방지)
changeOrigin: true,
// Ingress의 rewrite-target과 동일한 역할.
// '/api/themes' -> '/themes'로 경로를 재작성하여 백엔드에 전달
rewrite: (path) => path.replace(/^\/api/, ''),
},
},
},
})

View File

@ -1,21 +0,0 @@
package roomescape.common.config
import org.springframework.beans.factory.annotation.Value
import org.springframework.context.annotation.Configuration
import org.springframework.web.servlet.config.annotation.CorsRegistry
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer
@Configuration
class CorsConfig : WebMvcConfigurer {
@Value("\${cors-origin}")
private lateinit var origin: String
override fun addCorsMappings(registry: CorsRegistry) {
registry.addMapping("/**")
.allowedOrigins(origin)
.allowedMethods("GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS")
.allowedHeaders("Authorization", "Content-Type")
.maxAge(3600) // 1 hour
}
}

View File

@ -37,5 +37,3 @@ management:
tracing:
transport: ${OTLP_TRACING_PROTOCOL}
endpoint: ${OTLP_TRACING_ENDPOINT}
cors-origin: ${CORS_ORIGIN}

View File

@ -45,5 +45,3 @@ management:
tracing:
sampling:
probability: 1
cors-origin: "http://localhost:5173"