Webpack hot reload (HMR) behind a reverse proxy

When using Webpack behind a reverse proxy like LocalCan, you will need to add this code to the webpack.config.js file in order to use hot reloads (HMR) which work through a WebSocket connection.

allowedHosts: 'all',
client: {
	webSocketURL: 'auto://',

After adding these, WebSocket connection will be established successfully on both http (ws) and https (wss) connections.

© 2024 LocalCan™. All rights reserved.