vaadin / flow

Vaadin Flow is a Java framework binding Vaadin web components to Java. This is part of Vaadin 10+.
Apache License 2.0
620 stars 167 forks source link

Websocket connection failed in dev mode and SSL #13632

Open simasch opened 2 years ago

simasch commented 2 years ago

Description of the bug

After migrating the application from 14 to 23 we get this error when running in dev mode with Spring Boot dev tools:

image

Expected behavior

There shouldn't be an error in the dev mode

Minimal reproducible example

  1. Create a new Vaadin 23 app
  2. Create a self-signed certificate
  3. Configure
    
    server.port=${PORT:8443}
    server.ssl.enabled=true
    server.ssl.protocol=TLS
    server.ssl.enabled-protocols=TLSv1.2
    server.ssl.key-store-type=PKCS12
    server.ssl.key-store=..\\..\\keyStore.p12
    server.ssl.key-store-password=xxx
    server.ssl.key-alias=1


### Versions

- Vaadin / Flow version: 23
- Java version: 17
- OS version: Windows 11
mcollovati commented 2 years ago

Url for websocket connection to dev server is based on current browser URL or PUSH url configuration, so when using https it is will be a wss://, however dev server is served over http.. Webpack can be configured to be served over https with a setting in webpack.config.json, but then AbstractDevServer fails to forward request because http protocol is hard-coded.

Just for the record, here is the https configuration for webpack.config.json

module.exports = merge(flowDefaults,
  {
      devServer: { https: true } 
  }
);
Artur- commented 2 years ago

I think we should do #13646 to solve this. It is the Spring Boot live reload server that it tries to connect to on port 35729, does webpack have any involvement here?

mcollovati commented 2 years ago

@Artur- You're completely right, webpack isn't involved here. Sorry