Skip to content

Commit

Permalink
Merge pull request #14 from wiemanboy/feature/fix-allow-public-data
Browse files Browse the repository at this point in the history
ADD: cors config to make all resources public
  • Loading branch information
wiemanboy authored Oct 19, 2024
2 parents 2c4f8e0 + 7c44994 commit 5814d79
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>com.wiemanboy</groupId>
<artifactId>WiemanApi</artifactId>
<version>1.1.3</version>
<version>1.1.4</version>
<name>WiemanApi</name>
<description>WiemanApi</description>
<url/>
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/com/wiemanboy/wiemanapi/config/GlobalCorsConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.wiemanboy.wiemanapi.config;

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 GlobalCorsConfig implements WebMvcConfigurer {

@Override
public void addCorsMappings(CorsRegistry corsRegistry) {
corsRegistry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
.allowedHeaders("*")
.allowCredentials(false);
}
}

0 comments on commit 5814d79

Please sign in to comment.