Skip to content

Commit a1a162d

Browse files
author
Rajeev Kumar Singh
committedJul 22, 2018
Added CORS config
1 parent 7d33d28 commit a1a162d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed
 

‎polling-app-server/src/main/java/com/example/polls/config/WebMvcConfig.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,13 @@
1111
@Configuration
1212
public class WebMvcConfig implements WebMvcConfigurer {
1313

14+
private final long MAX_AGE_SECS = 3600;
15+
1416
@Override
1517
public void addCorsMappings(CorsRegistry registry) {
16-
registry.addMapping("/**");
18+
registry.addMapping("/**")
19+
.allowedOrigins("*")
20+
.allowedMethods("HEAD", "OPTIONS", "GET", "POST", "PUT", "PATCH", "DELETE")
21+
.maxAge(MAX_AGE_SECS);
1722
}
1823
}

0 commit comments

Comments
 (0)