#Unable to access remote url.
39 messages · Page 1 of 1 (latest)
Are you using the tauri fetch plugin?
@exotic plank i am simply fetching like this const response = await fetch(url + 'system');
So you're using the "browser" fetch
yes
Tauri 1 or 2?
2
I suggest you to replace your fetch calls with this https://v2.tauri.app/reference/javascript/http/
The syntax should be the same
You just need to import it
Sorry I sent the wrong link
Just run bash npm run tauri add http
And then setup your permission like shown on the docs with a wildcard to accept anything
in dev build i am able to access remote url of my server but when i build the app does not able to access my remote api url
did you try a debug build viatauri build --debug(output in target/debug/) to be able to check the devtools for errors?
@primal shoal Mixed Content: The page at '<URL>' was loaded over HTTPS, but requested an insecure resource '<URL>'. This request has been blocked; the content must be served over HTTPS. This is the issue its showing
If you use the http plugin instead this issue will not occur but if for some reason you want to use the webview fetch apis I'm not sure if it can be fixed
Okay, that's a windows only issue then which you can workaround by either using tauri's http client as suggested above or by changing the webview origin to http via https://tauri.app/v1/api/config#securityconfig.dangeroususehttpscheme
wait
it does use http on v2 already
are you using an old alpha version or something?
Is it injected in the webview by default?
i was talking about the url/origin, not the plugin
http vs https
ah rip, if you want to stick with the alpha then you'll have to use the http plugin as it doesn't support changing the origin to http
Write 2.0.0-beta on every tauri thing instead of the version that you currently have on you cargo.toml
write >=2.0.0-beta.0 as version on every tauri related npm dep in your package.json
run [npm/bun/pnpm] install
and then try running your app again
It'll probably give you some error since I think that tauri initialization part is not same from back then
@exotic plank i just done pnpm update
Error tauri.conf.json error on build: Additional properties are not allowed ('devPath', 'distDir', 'withGlobalTauri' were unexpected)
Error tauri.conf.json error: Additional properties are not allowed ('package', 'tauri' were unexpected)
stated giving errors in config
This is what a modern tauri config should look like
{
"productName": "testtodelete",
"version": "0.0.0",
"identifier": "com.tauri.dev",
"build": {
"beforeDevCommand": "bun run dev",
"devUrl": "http://localhost:1420",
"beforeBuildCommand": "bun run build",
"frontendDist": "../dist"
},
"app": {
"withGlobalTauri": true,
"windows": [
{
"title": "testtodelete",
"width": 800,
"height": 600
}
],
"security": {
"csp": null
}
},
"bundle": {
"active": true,
"targets": "all",
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
]
}
}
honestly if possible i would just create a new app and copy your old frontend files manually into that
Just update your to look like this
ok , will try both things