fix cors allowed methods????
All checks were successful
Deploy API / deploy (ubuntu-latest, 2.44.0) (push) Successful in 57s
All checks were successful
Deploy API / deploy (ubuntu-latest, 2.44.0) (push) Successful in 57s
This commit is contained in:
parent
6f934af172
commit
4ca588b61c
@ -7,6 +7,8 @@ import org.springframework.boot.SpringApplication;
|
|||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration;
|
import org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.http.HttpMethod;
|
||||||
|
import org.springframework.web.servlet.config.annotation.CorsRegistration;
|
||||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
@ -47,8 +49,11 @@ public class PulseAPI {
|
|||||||
@Override
|
@Override
|
||||||
public void addCorsMappings(@NonNull CorsRegistry registry) {
|
public void addCorsMappings(@NonNull CorsRegistry registry) {
|
||||||
// Allow all origins to access the API
|
// Allow all origins to access the API
|
||||||
registry.addMapping("/**")
|
CorsRegistration registration = registry.addMapping("/**")
|
||||||
.allowedOrigins("*"); // Allow all origins
|
.allowedOrigins("*");// Allow all origins
|
||||||
|
for (HttpMethod method : HttpMethod.values()) {
|
||||||
|
registration.allowedMethods(method.name());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user