springboot-nginx-isSameOrigin-error

created at 07-04-2021 views: 5

error message

java.lang.NullPointerException  
        at org.springframework.web.util.WebUtils.isSameOrigin(WebUtils.java:816)  
        at org.springframework.web.cors.DefaultCorsProcessor.processRequest(DefaultCorsProcessor.java:76)  
        at org.springframework.web.servlet.handler.AbstractHandlerMapping$CorsInterceptor.preHandle(AbstractHandlerMapping.java:503)  
        at org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:134)  
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:956)  
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:895)  
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967)  
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:869)  
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:648) 

solution

Nginx configuration forwarding increases the request header

proxy_set_header        X-Real-IP       $remote_addr;  
        proxy_set_header        Host            $host;  
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;  
        proxy_pass_request_headers              on;  
created at:07-04-2021
edited at: 07-04-2021: