tauri icon indicating copy to clipboard operation
tauri copied to clipboard

[bug]Axios sends request but cannot get result

Open yIllusionSky opened this issue 10 months ago • 1 comments

Describe the bug

I have configured cross-domain on the server backend, and axios obtains requests normally in cargo tauri dev and cargo tauri android dev. I do not use the route of vite for cross-domain, but directly get the results through axios target url. . But when I use cargo tauri android build, I cannot jump on the login page (normally it is a jump), and Axios cannot get any resources.

I am using tauri2.0-beta.13, the latest version of rustc nightly, and the front end uses bun.

Reproduction

axios cannot return request

Expected behavior

axios return request

Full tauri info output

[✔] Environment
    - OS: Mac OS 14.4.1 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.79.0-nightly (dbce3b43b 2024-04-20)
    ✔ cargo: 1.79.0-nightly (80d5b607d 2024-04-19)
    ✔ rustup: 1.27.0 (bbb9276d2 2024-03-08)
    ✔ Rust toolchain: nightly-aarch64-apple-darwin (environment override by RUSTUP_TOOLCHAIN)
    - bun: 1.0.36

[-] Packages
    - tauri [RUST]: 2.0.0-beta.15
    - tauri-build [RUST]: 2.0.0-beta.12
    - wry [RUST]: 0.39.1
    - tao [RUST]: 0.27.0
    - tauri-cli [RUST]: 2.0.0-beta.13
    - @tauri-apps/api : not installed!
    - @tauri-apps/cli [NPM]: 2.0.0-beta.13

[-] App
    - build-type: bundle
    - CSP: default-src 'self'; img-src 'self' data:;; connect-src ipc: http://ipc.localhost
    - frontendDist: ../dist
    - devUrl: http://localhost:5173/
    - framework: Vue.js
    - bundler: Vite

[-] iOS
    - Developer Teams: None

Stack trace

No response

Additional context

No response

yIllusionSky avatar Apr 22 '24 05:04 yIllusionSky

Try use tauri http request

muwoo avatar Apr 22 '24 06:04 muwoo

Try use tauri http request

this will fix the issue, as tauri does not allow the embedded browser to make requests directly also configure the project permissions to allow requests to the required urls Read further

GaryCraft avatar May 01 '24 07:05 GaryCraft

Try use tauri http request

Try use tauri http request

this will fix the issue, as tauri does not allow the embedded browser to make requests directly also configure the project permissions to allow requests to the required urls Read further

Thank you! Following your advice, the problem has been solved.

yIllusionSky avatar May 06 '24 11:05 yIllusionSky