How to change the HMR domain (the "origin")?
trusktr opened this issue · comments
I'm running my dev server online, and it detect the HMR domain to be my server's IP, like 34.234.56.4:3003
, and it tries to access https://34.234.56.4:3003
at runtime, which is not allowed by my server.
How I can I specify for it to use a certain domain? F.e., I'd like it to use dev.example.com:3003
so that at runtime it will access https://dev.example.com:3003
without problems.
Right now, I see errors like this in Chrome devtools:
https://34.234.56.4:3003/socket.io/?EIO=3&transport=polling&t=MrMerUL&b64=1 net::ERR_CONNECTION_REFUSED
because the server doesn't not allow connections like that.
Alright, I can use HMR_URL
to specify the domain, but how do I tell it not to use a port? I need HMR to just access a URL with only domain, without the port.
Dang, looks like there's no way, the code does:
const PORT = parseInt(process.env.HMR_PORT) || parseInt(process.env.VUE_DEV_SERVER_PORT) || getMeteorPort() || 3003
which forces the port to exist.
For reference, that code prevents from doing this:
HMR_URL=dev-server.example.io HMR_PORT="" meteor -p 2345
because the empty string returns falsey in the code.
EDIT: Actually, the dev-server still needs the port, in order to launch the server.
So, a port is still needed for dev-server, just that the client should not try to use a port.
It'd be great to have a way to tell only the client code not to use a port (but the server still need to read the HOST_PORT
env var, and fallback to the meteor port +3, in order to launch).
There always is a port when you use the network on a computer. By default, using http the port is 80 and https it's 443. The list of commonly used ports on wikipedia.
You can't start a server without a port.