wry icon indicating copy to clipboard operation
wry copied to clipboard

Is there a way to open a self signed certification https site with wry::WebViewBuilder?

Open cyberpsyche opened this issue 1 year ago • 2 comments

I'm a newbie in Rust and Wry. I searched the lib.rs source but cannot find a 'fn' looks like "with_accept_invalid_certi' or "with_accept_unsecure_certi' or such functions like that. Maybe it's not related to Wry itself.

I just use the simple example in the repository and try to build a desktop app to show a local network website which is self signed before. I can open many websites by using the simple example code, but if I change the url to "https://192.168.1.xxx" then I could only get a blank window with nothing information output to the shell terminal. In the mean while, I could visit the "https://192.168.1.xxx" website on my browser, both on Chrome and Safari. (Of course, the browser showed it's "not secure", but you can still visit it.)

Is there a proper way to handle this issue ? Thanks for your help so much!

cyberpsyche avatar Feb 17 '24 10:02 cyberpsyche

This is interesting because in Electron you can replace window.fetch with node-fetch which has

const httpsAgent = new https.Agent({
  rejectUnauthorized: false,
});

async function getData() {
  const resp = await fetch(
    "https://myexampleapi.com/endpoint",
    {
      agent: httpsAgent,
    },
  )
  const data = await resp.json()
  return data
}

How can the equivalent be achieved in wry?

brandonros avatar Dec 21 '24 19:12 brandonros

This is interesting because in Electron you can replace window.fetch with node-fetch which has

In Tauri apps the http plugin would be the equivalent to that though it also can't do what's requested here just yet (easy to add, though and iirc there's an open PR). In Wry you'd have to do what the plugin does in Rust yourself.

FabianLars avatar Dec 23 '24 20:12 FabianLars