Fix CORS in prod
All checks were successful
Deploy API / deploy (ubuntu-latest, 2.44.0) (push) Successful in 39s

This commit is contained in:
Braydon 2024-09-18 00:58:34 -04:00
parent 3c471b5cd7
commit 29f0d39a78

@ -0,0 +1,27 @@
package cc.pulseapp.api.config;
import lombok.NonNull;
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;
/**
* @author Braydon
*/
@Configuration
public class AppConfig {
@Bean
public WebMvcConfigurer configureCors() {
return new WebMvcConfigurer() {
@Override
public void addCorsMappings(@NonNull CorsRegistry registry) {
// Allow all origins to access the API
registry.addMapping("/v*/**")
.allowedOrigins("*") // Allow all origins
.allowedMethods("*") // Allow all methods
.allowedHeaders("*"); // Allow all headers
}
};
}
}