-
-
Notifications
You must be signed in to change notification settings - Fork 900
Description
Describe the bug
When developing Plone with Volto on a remote server, VM, WSL, or any environment where the frontend is accessed from a different machine, CSS and JavaScript fail to load because the HMR (Hot Module Replacement) assets reference localhost:3001.
The browser on the remote machine tries to load assets from localhost:3001, but localhost refers to the browser's machine, not the server running Volto.
Current Workaround
Users must manually set the HOST environment variable:
HOST=192.168.1.100 make frontend-start
This workaround is documented in:
plone/documentation#1780
plone/cookieplone#52
Volto should work correctly when accessed from a different network interface without requiring users to manually specify the HOST environment variable.
Suggested Solutions
Use relative URLs for HMR assets - Instead of http://localhost:3001/..., use relative paths like //hostname:3001/... where hostname is derived from the request.
Auto-detect host from request headers - The server could read the Host header from incoming requests and dynamically generate HMR URLs.
Proxy HMR through the main port - Route HMR WebSocket connections through port 3000 instead of requiring a separate port 3001.
Use window.location.hostname - On the client side, use the browser's current hostname instead of hardcoded localhost.
Related Issues
plone/documentation#1780
plone/cookieplone#52
Related PR
plone/documentation#2040