Closed XPein closed 4 weeks ago
Do you have CORS set up on that server? On production your app URL is not a localhost URL (http://localhost:someport) but http://tauri.localhost
on Windows/Android and tauri://localhost
on other platforms.
I had a similar problem recently and in my tests, while developing on Linux I got the following origins:
http://localhost:1420
-> Browser and Linux dev builds
http://tauri.localhost
-> Android dev, debug and release builds; Linux debug build
tauri://localhost
-> Linux release build
My android app couldn't do fetch my local API, and that only happened with release builds, so after debugging I found out that the problems was the value of usesCleartextTraffic
. On release builds the value is false
, which means that the "access" to non encrypted resources are blocked, so you would need to change your API scheme to https
or change the value of usesCleartextTraffic
to true
.
Closing due to inactivity. Will re-open once OP answered Lucas' question.
P.S. since you're on v1, try this setting too https://v1.tauri.app/v1/api/config/#securityconfig.dangeroususehttpscheme
Describe the bug
build my app with "cargo tauri dev", my application successfully interacts with the server via HTTP. However, after deploying the same code to the production environment, HTTP communication with the server fails:fetch failed . The codebase is identical in both environments, so the issue may be related to product configurations.
Reproduction
allowlist:
run "cargo tauri build" and run target/release/xxx.exe can not interact with sever, because fetch error. run "cargo tauri dev" and run app, can interact with server
Expected behavior
No response
Full
tauri info
outputStack trace
No response
Additional context
No response