Skip to content

HMR not working with custom domain #1241

Closed
@jkobus

Description

@jkobus

Hello,

I have a dev environment with following docker-compose setup:

  • node (on port 9100)
  • php
  • nginx (443 serves files from php, the /assets path is a reverse proxy for nginx: https://node:9100/xxx.js -> https://customdomain.com/assets/xxx.js)

I'm also using the cloudflared tunnel to expose my local environment to the outside world. I do not use any authentication ATM.

So right now the actual web socket url is https://customdomain.com/ws (connection is tested and I am able to connect to it, it sends messages, so nginx configuration is okay).
Unfortunately, webpack is attempting to connect to https://customdomain.com:9100/ws

My devServer config:

    .configureDevServerOptions(options => {
        options.liveReload = true;
        options.host = '0.0.0.0';
        options.port = 9100;
        options.allowedHosts = 'all';
        options.static = {
            watch: false
        };
        options.watchFiles = {
            paths: ['src/**/*.php', 'templates/**/*', 'translations/**/*'],
        };
        options.server = {
            type: 'https',
            options: {
                key: '/app/docker/nginx/certs/default.key',
                cert: '/app/docker/nginx/certs/default.crt',
            }
        };
        // options.client = {
        //     webSocketURL: 'wss://customdomain.com/ws',
        // };
    });
if (!Encore.isProduction()) {
    Encore.setPublicPath('https://customdomain.com/assets');
    Encore.setManifestKeyPrefix('build/');
}

The webSocketURL option is not working, I do not see any errors in the docker console nor any websocket connection in chrome dev tools.

I was looking into #951, #1095, #1094 but I'm unable to find a solution.

Webpack encore version:

yarn list | grep encore
├─ @symfony/webpack-encore@4.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions