Skip to content

Commit e7782fe

Browse files
authored
fix: add crossorigin for cors policy (#6)
1 parent da6bcd4 commit e7782fe

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package it.gov.pagopa.message.core.configuration;
2+
3+
import org.springframework.context.annotation.Bean;
4+
import org.springframework.context.annotation.Configuration;
5+
import org.springframework.web.servlet.config.annotation.CorsRegistry;
6+
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
7+
8+
@Configuration
9+
public class SecurityConfig {
10+
@Bean
11+
public WebMvcConfigurer corsConfigurer() {
12+
return new WebMvcConfigurer() {
13+
@Override
14+
public void addCorsMappings(CorsRegistry registry) {
15+
registry.addMapping("/**")
16+
.allowedOrigins("http://localhost:3000")
17+
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
18+
.allowedHeaders("*")
19+
.allowCredentials(true);
20+
}
21+
};
22+
}
23+
}
24+

0 commit comments

Comments
 (0)