Request blocked by CORS policy

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

public class CorsConfig {
    public WebMvcConfigurer corsConfigurer() {

        return new WebMvcConfigurer() {
            public void addCorsMappings(CorsRegistry registry) {
                        .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")

When I am testting the api via postman its running fine. After deplying on I am making the post request from frontend like this

try {
        const data = prepareData();
        const { data : response } = await``,
      } 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

This issue is resolved. I haven’t updated the jar file

could you please help me. I don’t understand why my POST request doesn’t work. I make the post request from frontend as a formData. What kind of endpoint should be? I see you make But if i have an index.php in the root of my app, how can i receive back the response to frontend. The post request with the endpoint like **/v1/index.php or **/api/v1/index.php doesn’t work.
This is my question here: POST request is wrong
Thank you!

You have to make api call to specific endpoint of the api to get the data to frontend. After that you can show the data to frontend as you like. Here are the endpoints for this api

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.