Nginx下配置socket支持
server {
listen 80;
server_name test.domain.com;
# 转发站页面
location ^~ /socket/ {
proxy_pass http://192.168.2.10:8080/socket/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
异常情况如下
HTTP Status 500 – Internal Server Error Type 异常报告 消息 Request processing failed; nested exception is org.springframework.web.socket.sockjs.SockJsException: Uncaught failure in SockJS request, uri=http://192.168.2.10:8080/socket/online/liveness/250/2pv5gcc1/eventsource; nested exception is org.springframework.web.socket.sockjs.SockJsTransportFailureException: Failed to open session; nested exception is java.lang.IllegalArgumentException: Async support must be enabled on a servlet and for all filters involved in async request processing. This is done in Java code using the Servlet API or by adding "true" to servlet and filter declarations in web.xml. Also you must use a Servlet 3.0+ container 描述 服务器遇到一个意外的情况,阻止它完成请求。 Exception org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.web.socket.sockjs.SockJsException: Uncaught failure in SockJS request, uri=http://192.168.2.10:8080/socket/online/liveness/250/2pv5gcc1/eventsource; nested exception is org.springframework.web.socket.sockjs.SockJsTransportFailureException: Failed to open session; nested exception is java.lang.IllegalArgumentException: Async support must be enabled on a servlet and for all filters involved in async request processing. This is done in Java code using the Servlet API or by adding "true" to servlet and filter declarations in web.xml. Also you must use a Servlet 3.0+ container org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1013) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897) javax.servlet.http.HttpServlet.service(HttpServlet.java:634) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882) javax.servlet.http.HttpServlet.service(HttpServlet.java:741) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) com.nr.base.util.lang.LangFilter.doFilter(LangFilter.java:54) com.nr.base.util.AuthFilter.doFilter(AuthFilter.java:56) org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) com.nr.base.priv.shiro.filterchain.CustomShiroFilterFactoryBean$SpringShiroFilter.doFilterInternal(CustomShiroFilterFactoryBean.java:498) org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357) org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270) Root Cause



