#Unable to access remote url.

39 messages · Page 1 of 1 (latest)

viral plinth
#

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 , my app lets user to input that api url so i want to tauri to allow access to all remote urls .

exotic plank
viral plinth
#

@exotic plank i am simply fetching like this const response = await fetch(url + 'system');

exotic plank
viral plinth
#

yes

exotic plank
#

Tauri 1 or 2?

viral plinth
#

2

exotic plank
#

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

primal shoal
#

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 via tauri build --debug (output in target/debug/) to be able to check the devtools for errors?

viral plinth
#

@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

exotic plank
primal shoal
#

wait

#

it does use http on v2 already

#

are you using an old alpha version or something?

exotic plank
viral plinth
#

yes its a alpha version , i was using a premade template as my base

primal shoal
#

http vs https

primal shoal
viral plinth
#

ok i can update , i just have to figure out how .

#

@primal shoal @exotic plank

exotic plank
#

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

viral plinth
#

@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

exotic plank
# viral plinth <@171160142883192832> i just done pnpm update Error `tauri.conf.json` error on...

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"
    ]
  }
}

primal shoal
#

honestly if possible i would just create a new app and copy your old frontend files manually into that

exotic plank
viral plinth
#

ok , will try both things