Replies: 2 comments
|
This is a security boundary in WebKit/WebView2 — for good reason, IPC between the Go backend and a remote URL is disabled by default to prevent arbitrary websites from calling your Go methods. In Wails v3, calling Go methods from a remote URL requires the Recommended pattern for separate frontend development: Instead of loading a remote URL in production, develop the frontend separately but embed it at build time: //go:embed all:frontend/dist
var assets embed.FS
// During development: proxy to your dev server
// In production: serve from embedded FSDuring dev, If you truly need remote URL + Go IPC, you could expose a local HTTP/WebSocket endpoint from Go and call it from the remote page — this sidesteps the WebView IPC entirely and works from any URL. See the v3 docs on asset serving for more details on the embed pattern. |
|
Hi there! This is a very relevant question.. Let me describe our use case for IPC. Currently, we use a tiny Electron shell to forward WebSocket messages to MQTT. It is packaged with an installer and runs as a desktop app for the user. Eventually, we had to use the renderer for our remote frontend (via external URL). We did this to access secure storage and specific cryptographic functions via IPC, ensuring that sensitive data transfers aren't exposed However, I wanted to explore other solutions and was looking for something similar in the Go ecosystem. And here I am, trying Wails v3 and ending up here That was the preamble..) The main point is that there seems to be no need for IPC if we can't use it without an HTTPS server for security reasons. I don't like sounding too radical, but it feels like it defeats the purpose entirely in our case, we don't want to expose some sensitive data between local app and our remote frontend without having to pass tokens or authenticate both ends... I'm not an expert in such low-level protocols, so I might be mistaken. Please don't be too harsh on me! |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
In Wails v3, I am trying to load a remote webpage built with Vue 3. I installed the @wailsio/runtime package and attempted to call a Go method from the page like this:
When using wails3 dev and loading a local frontend, it works fine, for example:
However, when loading a remote webpage, it doesn’t work, for example:
I don’t want to integrate the frontend directly into Wails. I want to develop them separately, have Wails load a remote URL, and expose some interfaces from Wails to the webpage, similar to window['go'] in Wails v2 or Electron’s contextBridge.
In Wails v3, how can I call Go methods from a frontend page running in remote mode?
Thank you!
All reactions