I am trying to write an Api in spring boot and am trying to access it using frontend I have written. I have added the Cors support, still I am getting this error: *
Failed to load http://localhost:8080/: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.
My Cors support in main file is:
@Bean
public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurerAdapter() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/greeting-javaconfig").allowedOrigins("*");
}
};
}
I am using apache server for frontend.
Can sopmeone help me with the issue?
Aucun commentaire:
Enregistrer un commentaire