Skip to content

Commit

Permalink
Configs for allowing CORS requests (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
TsimurSh authored May 19, 2024
1 parent 3b6d304 commit 7df28c7
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions app/src/main/java/org/transitclock/config/WebConfiguration.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.transitclock.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
@EnableWebMvc
public class WebConfiguration implements WebMvcConfigurer {

@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/api/**")
.allowedOriginPatterns("http://**", "https://**")
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
.allowedHeaders("*")
.allowCredentials(true);
}
}

0 comments on commit 7df28c7

Please sign in to comment.