Local project OPTIONS request 500 error

clipboard.png
the front and rear ends are separated, the front end is localhost:2200, and the back end is localhost:8080 and localhost:8081
An options request will be sent first when sending a complex post request. But options requests 500

not even changing the springboot configuration file

endpoints.cors.allowed-methods="*"
endpoints.cors.allowed-origins="*"
endpoints.cors.allowed-headers="*"
endpoints.cors.max-age=3600

management.endpoints.web.cors.allowed-methods="*"
management.endpoints.web.cors.allowed-origins="*"
management.endpoints.web.cors.allowed-headers="*"
management.endpoints.web.cors.max-age=3600

you can"t even write a filter in utils.

 0 @Component
 1 public class CorsFilter implements Filter {
 2     @Override
 3     public void init(FilterConfig filterConfig) throws ServletException {
 4         // TODO Auto-generated method stub
 5     }
 6 
 7     @Override
 8     public void doFilter(ServletRequest req, ServletResponse res,
 9         FilterChain chain) throws IOException, ServletException {
10         HttpServletResponse response = (HttpServletResponse) res;
11         response.setHeader("Access-Control-Allow-Origin", "*");
12         response.setHeader("Access-Control-Allow-Methods",
13             "POST, GET, OPTIONS, DELETE");
14         response.setHeader("Access-Control-Max-Age", "3600");
15         response.setHeader("Access-Control-Allow-Headers",
16             "Content-Type, x-requested-with, X-Custom-Header, Authorization");
17         chain.doFilter(req, res);
18     }
19 
20     @Override
21     public void destroy() {
22         // TODO Auto-generated method stub
23     }
24 }

adding proxy http-proxy-middleware to the front end is no good.

background error
RESTEASY003655: No resource method found for options, return OK with Allow header
is there any other way?

Mar.13,2021

it is obvious that there is a background processing error, and there is no handler corresponding to the OPTIONS request. For cross-domain problems, the OPTIONS request returns 200 directly after Response Header is set.


this is a pre-check request, and the error code of this request indicates an internal error on the server.


I use filter on the Internet. The weird thing about
is that I need @ Order (1) to set the highest filter priority to take effect.

Menu