0

I have created a simple Rest API and now I want to consume it with Ajax requests. I can use all CRUD operations with Postman. However when I try to make a post request I get "405 Not Allowed" and in the response header it says "Allow:GET, HEAD, OPTIONS". So I guess I have to tell spring to allow other servers to make POST, DELETE and PUT requests.

I can send hardcoded data in my js script to the server through ajax-post requests. It's when I try to send it through a html-form it doesn't work.

Could anyone help me with this please.

grangos
  • 501
  • 1
  • 4
  • 4

1 Answers1

0

Based on this answer, maybe you will have to supply this configuration in your filter to the requests:

response.addHeader("Access-Control-Allow-Methods",
                        "GET, POST, PUT, DELETE");
edkeveked
  • 17,989
  • 10
  • 55
  • 93