[bug] Cannot connect android device to local nor remote server
Describe the bug
Android app is calling localhost instead of my local server's ip. I followed the tauri documentation and setup the frontend, vite.cofig, tauri.conf.json based on that. I'm running using pnpm tauri android dev --host. Calling the remote server gives me another error even though I allowed tauri:localhost origin.
Access to XMLHttpRequest at 'https://api.redacted' from origin 'http://tauri.localhost/' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
On iOS everything works fine. Non of the relevant issues provide a solution.
Reproduction
No response
Expected behavior
Calls to localhost should be routed to my local server's ip
Full tauri info output
[✔] Environment
- OS: Mac OS 15.1.1 x86_64 (X64)
✔ Xcode Command Line Tools: installed
✔ rustc: 1.82.0 (f6e511eec 2024-10-15)
✔ cargo: 1.82.0 (8f40fc59f 2024-08-21)
✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
✔ Rust toolchain: stable-x86_64-apple-darwin (default)
- node: 22.11.0
- pnpm: 9.13.2
- npm: 10.9.0
[-] Packages
- tauri 🦀: 2.1.1
- tauri-build 🦀: 2.0.3
- wry 🦀: 0.47.0
- tao 🦀: 0.30.8
- @tauri-apps/api : 2.1.1
- @tauri-apps/cli : 2.1.0
[-] Plugins
- tauri-plugin-store 🦀: 2.1.0
- @tauri-apps/plugin-store : 2.1.0
- tauri-plugin-shell 🦀: 2.0.2
- @tauri-apps/plugin-shell : 2.0.1
- tauri-plugin-fs 🦀: 2.0.3
- @tauri-apps/plugin-fs : 2.0.2
- tauri-plugin-log 🦀: 2.0.2
- @tauri-apps/plugin-log : 2.0.0
- tauri-plugin-dialog 🦀: 2.0.3
- @tauri-apps/plugin-dialog : 2.0.1
- tauri-plugin-global-shortcut 🦀: 2.0.1
- @tauri-apps/plugin-global-shortcut : 2.0.0
[-] App
- build-type: bundle
- CSP:
- frontendDist: ../dist
- devUrl: http://localhost:1420/
- framework: React
- bundler: Vite
Stack trace
No response
Additional context
Device running Android 14
Just to be sure, you allowed tauri://localhost/ for ios and http://tauri.localhost/ for android? We generally can't do anything against Access-Control-Allow-Origin errors on our side (we can't make the webview ignore it nor can we modify responses), it just has to be configured on the server correctly.