corsConfig add
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package com.example.fercoganbackend.configuration;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@Configuration
|
||||
public class CorsConfig {
|
||||
|
||||
@Bean
|
||||
public WebMvcConfigurer corsConfigurer() {
|
||||
return new WebMvcConfigurer() {
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/**") // permite todos los endpoints
|
||||
.allowedOrigins("*") // permite todas las apps cliente
|
||||
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") // métodos permitidos
|
||||
.allowedHeaders("*"); // cabeceras permitidas
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user