generated from pricelees/issue-pr-template
[#28] 쿠버네티스 환경 배포 #29
@ -1 +1 @@
|
|||||||
VITE_API_BASE_URL = "http://localhost:8080"
|
VITE_API_BASE_URL = '/api'
|
||||||
@ -1,7 +1,7 @@
|
|||||||
import axios, { type AxiosError, type AxiosRequestConfig, type Method } from 'axios';
|
import axios, { type AxiosError, type AxiosRequestConfig, type Method } from 'axios';
|
||||||
|
|
||||||
const apiClient = axios.create({
|
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,
|
timeout: 10000,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -8,4 +8,19 @@ export default defineConfig({
|
|||||||
react(),
|
react(),
|
||||||
tsconfigPaths(),
|
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/, ''),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@ -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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -37,5 +37,3 @@ management:
|
|||||||
tracing:
|
tracing:
|
||||||
transport: ${OTLP_TRACING_PROTOCOL}
|
transport: ${OTLP_TRACING_PROTOCOL}
|
||||||
endpoint: ${OTLP_TRACING_ENDPOINT}
|
endpoint: ${OTLP_TRACING_ENDPOINT}
|
||||||
|
|
||||||
cors-origin: ${CORS_ORIGIN}
|
|
||||||
@ -45,5 +45,3 @@ management:
|
|||||||
tracing:
|
tracing:
|
||||||
sampling:
|
sampling:
|
||||||
probability: 1
|
probability: 1
|
||||||
|
|
||||||
cors-origin: "http://localhost:5173"
|
|
||||||
Loading…
x
Reference in New Issue
Block a user