Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Cannot Reproduce
-
6.9.1
-
None
-
None
-
wicket-atmosphere 0.11, Tomcat 7.0
Description
HttpsMapper, with or without XForwardedRequestWrapper, seems to be problematic when combined with Atmosphere via WebSocket :
java.lang.IllegalStateException
Could not resolve protocol for request: org.apache.wicket.protocol.http.servlet.XForwardedRequestWrapper@cbb5077
Or without XForwardedRequestWrapper:
java.lang.IllegalStateException
Could not resolve protocol for request: c244911c-d8aa-4d66-a645-2ef935199b78
at org.apache.wicket.protocol.https.HttpsMapper.getSchemeOf(HttpsMapper.java:215) ~[wicket-core-6.9.1.jar:6.9.1]
at org.apache.wicket.protocol.https.HttpsMapper.mapHandler(HttpsMapper.java:167) ~[wicket-core-6.9.1.jar:6.9.1]
at org.apache.wicket.protocol.https.HttpsMapper.mapHandler(HttpsMapper.java:112) ~[wicket-core-6.9.1.jar:6.9.1]
although page "seems" operating normally, but it gives ERROR logs.
I think this is due to Atmosphere & HttpsMapper not detecting the scheme correctly? (ws/wss? actually "WebSocket")
protected Scheme getSchemeOf(Request request) { HttpServletRequest req = (HttpServletRequest) request.getContainerRequest(); if ("https".equalsIgnoreCase(req.getScheme())) { return Scheme.HTTPS; } else if ("http".equalsIgnoreCase(req.getScheme())) { return Scheme.HTTP; } else { throw new IllegalStateException("Could not resolve protocol for request: " + req); } }
I workaround it using:
setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), new HttpsConfig(8980, 8943)) { @Override protected Scheme getSchemeOf(Request request) { HttpServletRequest req = (HttpServletRequest) request.getContainerRequest(); log.info("Scheme for {} is {}", req, req.getScheme()); if ("https".equalsIgnoreCase(req.getScheme())) { return Scheme.HTTPS; } else if ("http".equalsIgnoreCase(req.getScheme())) { return Scheme.HTTP; } else if ("WebSocket".equalsIgnoreCase(req.getScheme())) { return Scheme.ANY; } else { throw new IllegalStateException("Could not resolve protocol for request: " + req + ", unrecognized scheme: " + req.getScheme()); } } });
If the above is proper way to do it, please update the HttpsMapper implementation, also with more detailed exception message above ("unrecognized scheme").
Attachments
Issue Links
- blocks
-
WICKET-5281 TomcatWebSocket error: WebSocket Redirect not supported on a @RequireHttps page
- Resolved
- is related to
-
WICKET-5279 o.a.w.a.AtmosphereBehavior onBroadcast should log DEBUG, not INFO
- Resolved