Configuring springboot for a single app page wasn't easy. I thought to meet a standard problem when debugging an react embedded in a springboot application. I read all the the posted questions about the topic but still cannot fix the problem.
The url and post data sent via postman hit the debug points in the app controller method and the request is successfull. That's fine. When the url rest api is fired from within the app in react by the browser, the debug point hit is the filter method which set the headers of the response, and nothing else. The controller method is not reached. That's weird.
The url and data are the same in the two cases, postman and browser requests, why controller is not reached in the second case ? Looks like the problem is within the server responding differently depending on the context. What is strange too is that the response header "Allow" does not contain the method POST.
I have added more logging, and the difference is that the post data in the browser case is not received by the server, despite the chrome console output shows it is actually sent. Indeed, i use the data showed to send it directly via postman, and the result is successfull. So how can i get more insight about the problem?
Thanks for your support in advance, Simon
In the application.yaml:management: security: enabled: false
I have added a filter to set headers:HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse; httpServletResponse.setHeader("Access-Control-Allow-Origin", "*"); httpServletResponse.setHeader("Allow", "GET, HEAD, OPTIONS, POST, PUT"); httpServletResponse.setHeader("Access-Control-Allow-Methods", "GET, OPTIONS, POST, PUT"); httpServletResponse.setHeader("Access-Control-Allow-Headers", "Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With");
Solved, there was a typo in the url in the ws request ...