Created a new project with create-tauri-app cli tool.
cd project && npm i
npm run tauri dev
The Rust part compiled fine.
The frontend window indicated Connection terminated unexpectedly.
Console logged Failed to load resource: Connection terminated unexpectedly http://localhost:1420/
(I use the React template so it's Vite port 1420 here)
Open http://localhost:1420 in browser, success.
Modified src-tauri/tauri.conf.json from
"build": {
"beforeBuildCommand": "npm run build",
"beforeDevCommand": "npm run dev",
"devUrl": "http://localhost:1420",
"frontendDist": "../dist"
},
to
"build": {
"beforeBuildCommand": "npm run build",
"beforeDevCommand": "npm run dev",
"devUrl": "http://127.0.0.1:1420",
"frontendDist": "../dist"
},
Same behavior.
Changed build.devUrl to https://google.com.
Contents from webpage showed up.
Modified vite.config.ts to add a host:
server: {
// Add my local ip address as host
host: "192.168.3.100",
port: 1420,
strictPort: true,
watch: {
// 3. tell vite to ignore watching `src-tauri`
ignored: ["**/src-tauri/**"],
},
},
Also set build.devUrl to http://192.168.3.100:1420
The front window loaded successfully.
So it appeared that my tauri refused to load any resource from a localhost or 127.0.0.1 host as its dev server.
I've checked /etc/hosts , pinged localhost, visited localhost contents from browser. Everything is fine.
Even started an nginx daemon and set build.devUrl to http://localhost yet failed to load, while http://192.168.3.100 works perfect.
Tried both v2 and v1 version of tauri. Exact the same problem.
I am now totally confused what could be the reason tauri does not load localhost.
I don't know if anyone could reproduce that, as I have tried to reproduce that in other machines and everyone else seemed ok with localhost.
I use Archlinux with KDE Plasma 6.0.4 in wayland.
Any suggestion is appreciated.
Solved.
Installed a webkit2gtk based browser (luakit).
Also failed to load localhost yet reminds me of system proxy maybe in use.
Remove the proxy setting of KDE system setting and the problem is solved.
Describe the bug
Created a new project with
create-tauri-app
cli tool. cd project && npm i npm run tauri dev The Rust part compiled fine. The frontend window indicatedConnection terminated unexpectedly
. Console loggedFailed to load resource: Connection terminated unexpectedly http://localhost:1420/
(I use the React template so it's Vite port 1420 here) Open http://localhost:1420 in browser, success. Modifiedsrc-tauri/tauri.conf.json
fromto
Same behavior. Changed
build.devUrl
tohttps://google.com
. Contents from webpage showed up.Modified
vite.config.ts
to add a host:Also set build.devUrl to
http://192.168.3.100:1420
The front window loaded successfully.So it appeared that my tauri refused to load any resource from a
localhost
or127.0.0.1
host as its dev server. I've checked/etc/hosts
, pinged localhost, visited localhost contents from browser. Everything is fine. Even started an nginx daemon and set build.devUrl tohttp://localhost
yet failed to load, whilehttp://192.168.3.100
works perfect.Tried both v2 and v1 version of tauri. Exact the same problem.
I am now totally confused what could be the reason tauri does not load localhost. I don't know if anyone could reproduce that, as I have tried to reproduce that in other machines and everyone else seemed ok with localhost. I use Archlinux with KDE Plasma 6.0.4 in wayland. Any suggestion is appreciated.
Reproduction
No response
Expected behavior
No response
Full
tauri info
outputStack trace
No response
Additional context
No response