Files
dognation_BT/src/main/java/com/dog/dognation/config/WebConfig.java
T

24 lines
955 B
Java
Raw Normal View History

package com.dog.dognation.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/** 프론트엔드(Vite dev / Capacitor 웹뷰)에서의 크로스 오리진 호출 허용. */
@Configuration
public class WebConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/api/**")
.allowedOrigins(
"http://localhost:9000", // Vite dev server
"http://localhost", // Capacitor(Android)
"capacitor://localhost", // Capacitor(iOS)
"ionic://localhost"
)
.allowedMethods("GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS")
.allowedHeaders("*");
}
}