Github user SvetlinZarev commented on the issue: https://github.com/apache/tomcat/pull/39 Issue Description === WsWebSocketContainer generates bad CONNECT request when a proxy is used. The host does not contain port information, hence the app cannot connect to wss:// endpoints. Also some stricter proxy servers may reject requests without port info, thus making WsWebSocketContainer.connectToServer() fail for both ws:// and wss:// endpoints. Steps to reproduce === Prerequisites --- 1. Download Tomcat 8.5.9 2. Configure it to use port 8081 3. Clone g...@github.com:adamfisk/LittleProxy.git 4. Clone MCVE: g...@github.com:SvetlinZarev/websocket-tomcat-bug.git 5. Build (3), (4) -> mvn clean install (you may want to rename the mcve to ROOT) How to reproduce it --- 1. Start LittleProxy (it defaults to port 8080) 2. Configure Tomcat use the proxy: export CATALINA_OPTS="-Dhttp.proxyHost=localhost -Dhttp.proxyPort=8080 -Dhttps.proxyHost=localhost -Dhttps.proxyPort=8080" 3. Start tomcat: catalina.sh run 4. Request the mcve: http://localhost:8081/ws Expected behavior --- You should see: Connected. Sending message... Message: Hello World! Disconnected: Actual behavior --- An exception is thrown. In case of LittleProxy it is a timeout exception during channel.handshake().get(); In my other case it is a DeploymentException caused by a bad request, because the (stricter) proxy rejected the request because it does not contain port info. Additional information --- You can play with the mcve by adding the following request parameters: * scheme - i.e. ws://, wss:// * server - i.e. echo.websocket.org Example: 4. Request the mcve with: http://localhost:8081/ws?scheme=wss://&server=echo.websocket.org:443 It will succeed. Now remove the port from teh server string. It will fail.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org