Skip to content

Commit

Permalink
edited cors logic to use web config
Browse files Browse the repository at this point in the history
  • Loading branch information
arinkulshi-skylight committed Nov 26, 2024
1 parent 63a30ba commit a9c9a48
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
18 changes: 18 additions & 0 deletions backend/src/main/java/gov/cdc/ReportVision/config/WebConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package gov.cdc.ReportVision.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 WebConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("http://localhost:5173")
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
.allowedHeaders("*")
.allowCredentials(true);
}
}

6 changes: 0 additions & 6 deletions backend/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,3 @@ management:
endpoint:
health:
show-details: always

cors:
allowed-origins: "http://localhost:5173"
allowed-methods: "GET,POST,PUT,DELETE,OPTIONS"
allowed-headers: "*"
allow-credentials: true

0 comments on commit a9c9a48

Please sign in to comment.