Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] WebSocket over SSL in Embedded Jetty 9

Thank you, Simone -

On Thu, Jun 23, 2016 at 4:02 PM, Simone Bordet <sbordet@xxxxxxxxxxx> wrote:

The server shows a NPE that is the root cause of your issue.

Your server-side code is wrong at line 40, where you specify the
SslConnectionFactory, you tell it that the next protocol is HTTP/1.1,
but then you don't add the HttpConnectionFactory.

Please look at https://github.com/eclipse/jetty.project/blob/jetty-9.3.10.v20160621/examples/embedded/src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java#L160

do I need to add

        ServerConnector sslConnector = new ServerConnector(server,
            new SslConnectionFactory(sslContextFactory,HttpVersion.HTTP_1_1.asString()),
            new HttpConnectionFactory(https_config));

even if I intend my embedding Jetty program to serve WebSocket connections only?

My background is that I am developing a word game and have purchased Thawte SSL certificate for 2 domains: "example.com" and "www.example.com".

On example.com ports 80 and 443 Apache+WordPress is running and serves HTML5 canvas with the game.

On www.example.com (different IP address!) ports 80 and 443 I am trying to run embedded Jetty which would answer WebSocket requests.

If a player would ever manually enter "www.example.com" into her browser, I would like Jetty to rewrite the URL to "example.com" and redirect.

So would I need new HttpConnectionFactory(https_config) here?

Thank you for any insights
Alex


Back to the top