You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We currently have a CORS filter (CORSFilter) in our codebase to handle Cross-Origin Resource Sharing. However, there is a more modern and Spring-centric approach using WebMvcConfigurer. This issue aims to replace the existing CORSFilter with the WebMvcConfigurer-based configuration.
PROPOSED CHANGES
Replace the existing CORSFILTER.java class under config with the following configurtaion in DatabaseConfiguration.java
@Bean
public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurer() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("*")
.allowedHeaders("*")
.allowCredentials(false).maxAge(3600);
}
};
}
This approach is more in line with modern Spring practices and provides a concise and effective way to handle CORS globally in our Spring Boot application and thereby reduces the boilerplate code
The text was updated successfully, but these errors were encountered:
We currently have a CORS filter (CORSFilter) in our codebase to handle Cross-Origin Resource Sharing. However, there is a more modern and Spring-centric approach using WebMvcConfigurer. This issue aims to replace the existing CORSFilter with the WebMvcConfigurer-based configuration.
PROPOSED CHANGES
Replace the existing CORSFILTER.java class under config with the following configurtaion in DatabaseConfiguration.java
This approach is more in line with modern Spring practices and provides a concise and effective way to handle CORS globally in our Spring Boot application and thereby reduces the boilerplate code
The text was updated successfully, but these errors were encountered: