I have a very frustrating problem. I have a my put servive in jersy and I call it via axios. Here is my code for jersy:
@PUT
@Path("/{id}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Response update(@PathParam("id") int id, String jsonRequest) {
return new UpdateController().updateUser(id, jsonRequest);
}
Here is how I call it in the front end:
axios.put(putURL, newUserPreferences)
.then(response => {
.
.
So if I call it with the avobe put request I get the following error code:
Failed to load puturl...: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3003' is therefore not allowed access. The response had HTTP status code 403.
Can anyone help why it is happening?