Hi everyone. I am facing problem regarding CORS issue. I have an spring boot api which is hosted on github. I have deployed it on render by Docker. I have configured CORS and this is my config file
@Configuration
public class CorsConfig {
@Bean
public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurer() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
.allowedHeaders("*");
}
};
}
}
When I am testting the api via postman its running fine. After deplying on render.com I am making the post request from frontend like this
try {
const data = prepareData();
const { data : response } = await axios.post(`https://numerical-methods-solver.onrender.com/api/v1/interpolation/newtonForwardInterpolation`,
data
);
setResult(response);
} catch (error) {
console.error("Error in Axios request:", error);
}
Its giving CORS error
I have gone through all the topics on this community regarding this but still not resolved. Please help