Spaces:
Sleeping
Sleeping
Commit ·
eaab089
1
Parent(s): 89bae07
add cors config
Browse files
src/main/java/com/artandscience/webbff/webbff/configuration/CorsConfiguration.java
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
package com.artandscience.webbff.webbff.configuration;
|
| 2 |
+
|
| 3 |
+
import org.springframework.context.annotation.Configuration;
|
| 4 |
+
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
| 5 |
+
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
| 6 |
+
|
| 7 |
+
@Configuration
|
| 8 |
+
public class CorsConfiguration implements WebMvcConfigurer {
|
| 9 |
+
|
| 10 |
+
@Override
|
| 11 |
+
public void addCorsMappings(CorsRegistry registry) {
|
| 12 |
+
registry
|
| 13 |
+
.addMapping("/**")
|
| 14 |
+
.allowedOrigins(
|
| 15 |
+
"http://localhost:3000",
|
| 16 |
+
"https://artandscience.sarvenyanik.workers.dev"
|
| 17 |
+
)
|
| 18 |
+
.allowedMethods(
|
| 19 |
+
"GET",
|
| 20 |
+
"POST",
|
| 21 |
+
"PUT",
|
| 22 |
+
"PATCH",
|
| 23 |
+
"DELETE",
|
| 24 |
+
"OPTIONS"
|
| 25 |
+
)
|
| 26 |
+
.allowedHeaders("*")
|
| 27 |
+
.allowCredentials(true)
|
| 28 |
+
.maxAge(600);
|
| 29 |
+
}
|
| 30 |
+
}
|