quasar
quasar copied to clipboard
Capacitor and webpack devserver : allowedHosts seems to be not taken into account
What happened?
Hello,
When building a Capacitor App in dev mode, i would like to have a host like :
host: 'mysubdomain.eu.ngrok.io'
This host config goes to the devServer block of Quasar.conf.js and it's used by the capacitor.config.json in the android folder to start the app.
I want to have this because i found no better way to test my app on my phone and having secureContext enabled.
To make it work, i need to disable the host check by setting :
allowedHosts: 'all',
or by specifying the host name.
The problem that, it seems, this parameter is not taken into account when Quasar start the dev server.
Looking Quasar source code, when dev server is starting, Quasar is doing this
try {
const openPort = await findPort(port, host)
if (port !== openPort) {
warn()
warn(`️️Setting port to closest one available: ${openPort}`)
warn()
port = openPort
}
}
this findPort leads to this code
const tester = net.createServer()
.once('error', err => {
if (err.code === 'EADDRNOTAVAIL') {
reject(new Error('ERROR_NETWORK_ADDRESS_NOT_AVAIL'))
}
So we can see that in any case we try to create the server and at no time i found an exception where we sould bypass this check when allowedHosts is filled.
Maybe i'm mistaken but this is my understanding.
What did you expect to happen?
To have allowedHosts taken into account in devServer.
Reproduction URL
not successed to have a sandebox in capacitor mode (because it needs Android Studio to start)
How to reproduce?
start a Capacitor project put a host outside local network in devServer fill allowedHosts with the host name See the error: 'Invalid host specified. No network address matches. Please specify another one."
Flavour
Quasar CLI (@quasar/cli | @quasar/app)
Areas
Capacitor Mode
Platforms/Browsers
No response
Quasar info output
No response
Relevant log output
No response
Additional context
Thank you very much
Hi @GrandOurs35! 👋
It looks like you provided an invalid or unsupported reproduction URL. Do not use any service other than Codepen, jsFiddle, Codesandbox, and GitHub. Make sure the URL you provided is correct and reachable. You can test it by visiting it in a private tab, another device, etc. Please edit your original post above and provide a valid reproduction URL as explained.
Without a proper reproduction, your issue will have to get closed.
Thank you for your collaboration. 👏
I have this error too when use "quasar dev" with Vite! I want to specify hostname to open the app with domain but failed:
"App • ⚠️ Invalid host specified. No network address matches. Please specify another one."
it ' s seems related to my problem also , i just add the host to my domain and the dev server don't start but print :
Invalid host specified. No network address matches. Please specify another one
how to specify a host for all the mode with quasar dev and an host for all the mode for quasar build ?
I have this error too when use "quasar dev" with Vite! I want to specify hostname to open the app with domain but failed:
"App • ⚠️ Invalid host specified. No network address matches. Please specify another one."
I have the same issue, quasar dev -m capacitor -T android change my ip window, it put my wsl ip instead of ip window. I cant acces from my mobile device