Fix CORS in prod
All checks were successful
Deploy API / deploy (ubuntu-latest, 2.44.0) (push) Successful in 39s
All checks were successful
Deploy API / deploy (ubuntu-latest, 2.44.0) (push) Successful in 39s
This commit is contained in:
parent
3c471b5cd7
commit
29f0d39a78
27
src/main/java/cc/pulseapp/api/config/AppConfig.java
Normal file
27
src/main/java/cc/pulseapp/api/config/AppConfig.java
Normal file
@ -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
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user