Update: May 2017
Starting with Jetty 9.4.0 onwards, the proprietary Jetty WebSocketClient supports Proxies through the Jetty HttpClient.
This works by declaring the HttpClient along with its proxy configurations, and then passing this the WebSocketClient constructor for use.
This only works with the following:
- Upgrading HTTP / 1.1 to WebSocket
- Native Jetty WebSocket API
This does not work with the following:
- HTTP / 2 (there is no specification for WebSocket over HTTP / 2 yet)
- JSR356 javax.websocket (there are ideas for the API that violate changes in the JSR356 ClientContainer to allow the Jetty HttpClient to be passed through the constructor, let us know if this is a viable option for you to submit a new problem to github , saying so)
Original answer
With Jetty 9, there is no proxy support for the Jetty Native WebSocket client or for implementing the JSR-356 client (javax.websocket).
This support is planned for Jetty 10 (which tracks Servlet 4) and will result in a complete redesign of the entire set of client libraries in Jetty to have equal support for:
- HTTP / 1.1
- HTTP / 2 (native / direct)
- Update HTTP / 1.1 to HTTP / 2 (h2c)
- Upgrading HTTP / 1.1 to WebSocket
- HTTP / 2 websocket channel (currently in draft)
- Proxy support.
- Cookie support
- etc.
Existing Jetty WebSocket client implementations are self-contained due to JSR-356 support requirements.
The existing WebSocket client does not use the existing Jetty HttpClient in Jetty 9.x. If so, then proxy support may perhaps work with a very limited set of scenarios.
This is a low priority feature request, as there are several existing proxies that still support WebSocket (in fact, they generally do not support HTTP / 1.1 updates very well). Even the proprietary Jetty Proxy server does not currently support HTTP / 1.1 updates.
source share