nw.js icon indicating copy to clipboard operation
nw.js copied to clipboard

Feature request: adding proxy settings to Window and <webview> tag

Open Sunvas opened this issue 3 years ago • 5 comments

Current Behavior

Entire NWjs application uses common proxy configuration https://nwjs.readthedocs.io/en/latest/References/App/#appsetproxyconfigconfig-pac_url.

Expected/Proposed Behavior

Is it possible to specify proxy configuration for Window and/or <webview> tag.

Sunvas avatar Aug 27 '22 02:08 Sunvas

@rogerwang any plans to implement this feature? ElectronJS already has this feature.

Sunvas avatar Apr 25 '25 23:04 Sunvas

@Sunvas after reading the link you post, I don't think Electron has this feature -- it sets the proxy for the whole session, not per window.

rogerwang avatar May 03 '25 23:05 rogerwang

@rogerwang in Electron you can create session with proxy settings and assign it session to BrowserWindow. There is such option in webPreferences.

Sunvas avatar May 04 '25 04:05 Sunvas

Yeah a session can be assigned to a window, and each session can have its own proxy settings. However, it's important to clarify that this is fundamentally different from supporting per-window proxy configuration as a standalone feature.

The key distinction is that a session encompasses far more than just proxy settings—it includes things like cookies, localStorage, cache, and other persistent data. Assigning a different session to a window means you're isolating all of those aspects, not just the proxy. This can lead to unintended side effects for applications that want to share session state (like cookies or storage) across windows but route them through different proxies.

What the proposed feature aims for is more granular control: allowing each window to have its own proxy configuration without affecting or duplicating session-level state. This is not achievable through the session-based approach, which tightly couples proxy settings with broader browsing context.

rogerwang avatar May 04 '25 13:05 rogerwang

@rogerwang , ok that's clear. And what about adding this feature for a <webview> tag?

Sunvas avatar May 04 '25 18:05 Sunvas