Skip to content

Commit

Permalink
updating cors
Browse files Browse the repository at this point in the history
  • Loading branch information
VauP committed Oct 9, 2023
1 parent 85be494 commit 58cf6c4
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions server/API/core/src/main/java/org/SciSight/config/CorsConfig.java
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
package org.SciSight.config;

import org.springframework.context.annotation.Bean;
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 CorsConfig {

@Bean
public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurer() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS")
.allowedHeaders("*")
.allowCredentials(true);
}
};
}
public class CorsConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOriginPatterns("*")
.allowedMethods("GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS")
.allowedHeaders("*")
.allowCredentials(true);
}
}

0 comments on commit 58cf6c4

Please sign in to comment.