Skip to content
poryajpPublic

About

A minimal Manifest V3 Chrome extension for managing and switching browser proxies from the toolbar. HTTP, SOCKS4 and SOCKS5, no dependencies, no backend.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Proxy Hub

Proxy Hub

A minimal Chrome extension for managing and switching browser proxies directly from the toolbar.

Manifest V3 Chrome 108+ Dependencies License: MIT

Overview

Proxy Hub applies a saved proxy configuration to Chrome through the official chrome.proxy API. All interaction takes place inside the toolbar popup: no options page is opened, no tab is created, and no external service is contacted.

The extension is written in plain HTML, CSS and ES modules. It has no build step, no runtime dependencies, and no backend. Proxy definitions are stored locally using chrome.storage.local and never leave the browser.

Features

  • Store up to five proxy servers using the HTTP, SOCKS4 or SOCKS5 protocols.
  • Enable or disable the active proxy with a single toggle.
  • Select the active proxy from a list; changing the selection while the toggle is enabled reconfigures Chrome immediately.
  • Create, edit and delete entries entirely within the popup.
  • Toolbar icon renders in colour while a proxy is active and in greyscale while it is inactive.
  • Optional credentials for HTTP proxies, supplied through the Manifest V3 authentication API. See Limitations.
  • Configuration persists across browser restarts and is reconciled against the browser's actual proxy state on startup.
  • Light and dark themes, following the operating system preference.

Installation

The extension is distributed as an unpacked extension.

  1. Download or clone this repository.
  2. Open chrome://extensions in Chrome 108 or later.
  3. Enable Developer mode using the toggle in the upper-right corner.
  4. Select Load unpacked and choose the repository directory — the directory that contains manifest.json.
  5. Optionally pin Proxy Hub to the toolbar from the extensions menu.

No build or packaging step is required; the sources are loaded as they are.

Usage

Adding a proxy. Open the popup, select Add proxy, and provide a name, protocol, host and port. Username and password are optional. Select Save.

Activating a proxy. Use the toggle at the top of the popup. The selected proxy is applied to Chrome immediately and the toolbar icon changes to its colour variant.

Changing the active proxy. Select any entry in the list. If the toggle is enabled, the new proxy takes effect at once. If the toggle is disabled, the selection is recorded but Chrome remains unproxied until the toggle is enabled.

Editing and deleting. Hover over an entry to reveal the edit and delete controls. Deletion requires a single confirmation. Deleting the proxy that is currently in use disables the proxy before the entry is removed, so traffic is never directed at a deleted configuration.

Permissions

Permission Purpose
proxy Reading and setting Chrome's proxy configuration.
storage Persisting proxy definitions, the current selection and the enabled state.
webRequest, webRequestAuthProvider Responding to proxy authentication challenges (HTTP 407). In Manifest V3 this pair is the only supported mechanism for supplying proxy credentials.
<all_urls> (optional) Requested at runtime, never at installation. Chrome delivers the authentication event only for URLs the extension may access. The permission is requested the first time an HTTP proxy is saved with a username, and at no other time. If it is declined, the extension continues to function and Chrome presents its own proxy sign-in dialog instead.

The authentication listener is registered only while the optional host permission is actually held, and is removed if the permission is revoked. Registering a webRequest listener without host access causes Chrome to record an error against the extension.

No tab, history, cookie or scripting permissions are requested. The extension performs no network requests of its own and contains no analytics or telemetry.

Limitations of the Chrome Proxy API

The following are constraints of Chrome itself. Where the intended behaviour could not be implemented literally, the closest supported behaviour was chosen and is documented below.

Chrome cannot authenticate SOCKS proxies

Chrome has never implemented username and password authentication for SOCKS4 or SOCKS5 (issue 40323993). SOCKS authentication is negotiated within the SOCKS handshake, which is below the layer any extension API can reach; onAuthRequired is raised only for HTTP-level 407 challenges.

Proxy Hub keeps the credential fields available for every protocol, displays a warning in the form when SOCKS4 or SOCKS5 is selected, and refuses to supply credentials to a SOCKS proxy rather than appearing to support it. For an authenticated SOCKS proxy, use address allow-listing at the provider or a local relay that injects the credentials.

webRequestBlocking is unavailable in Manifest V3

The permission is restricted to policy-installed extensions. The supported replacement is the webRequestAuthProvider permission together with onAuthRequired registered in "asyncBlocking" mode, which this extension uses. Asynchronous mode is required rather than preferred: a Manifest V3 service worker may have just been restarted, and credentials must be read back from storage before the event can be answered. This determines the minimum supported version of Chrome 108.

Proxy control is exclusive to one extension

Chrome grants proxy control to a single extension at a time. If another extension assumes control, this extension cannot apply any configuration. Rather than presenting a toggle that misrepresents the browser state, Proxy Hub detects the loss of control through levelOfControl and proxy.settings.onChange, disables itself, and reports the condition. The same applies when the setting is locked by enterprise policy.

A failing proxy falls back to a direct connection

proxy.onProxyError reports fatal: false when Chrome has abandoned the proxy and used a direct connection instead. For a proxy utility this distinction is material, as traffic leaves the browser unproxied while the toggle still reads as enabled. Proxy Hub reports this explicitly and preserves the underlying net:: error code, which is the single detail that makes the condition diagnosable.

Disabling releases control rather than forcing a direct connection

chrome.proxy.settings.clear() is called instead of applying mode: "direct". Forcing a direct connection would override a system-wide or PAC configuration defined outside Chrome; releasing control allows Chrome to return to its own configuration, which is the expected meaning of "off".

Loopback addresses are always excluded

localhost, 127.0.0.1 and [::1] are present in the bypass list so that enabling a proxy cannot sever access to local development servers.

Incognito windows

Settings are written to the regular scope. Incognito windows inherit that value, but only if the extension is permitted in incognito mode from chrome://extensions.

State after a browser restart

Chrome reapplies extension proxy settings during startup, potentially before the service worker runs. Proxy Hub does not depend on this: it re-reads storage on runtime.onStartup, reapplies the stored configuration and repaints the toolbar icon, so that stored state and actual browser state are reconciled rather than assumed.

Credential storage

chrome.storage.local is not encrypted. Credentials are held unencrypted within the Chrome profile on disk, as is the case for comparable extensions. They are transmitted only to the proxy that issues the challenge. This mechanism is not appropriate for sensitive credentials on a shared machine.

Troubleshooting

The toggle is enabled but traffic is not proxied

Open chrome://net-internals/#proxy. The Effective proxy settings section reports the configuration Chrome is actually using, for example:

Effective proxy settings: SOCKS5 127.0.0.1:10808
  • If the entry is absent or differs from the selected proxy, another extension or an enterprise policy holds proxy control. Review chrome://extensions and disable competing proxy or VPN extensions.
  • If the entry is correct but pages still load unproxied, the browser cannot reach the proxy server. Confirm that the server is accepting connections, for example with Test-NetConnection <host> -Port <port> on Windows or nc -vz <host> <port> elsewhere.

The error banner in the popup carries the exact net:: code reported by Chrome, which distinguishes between these cases.

chrome://extensions reports a host permission error for webRequest

Reload the extension. Builds prior to the current one registered the authentication listener before host access had been granted.

Project structure

proxy-hub/
├── manifest.json            Manifest V3 definition
├── src/
│   ├── background.js        Service worker: state changes and proxy control
│   └── lib/
│       ├── constants.js     Protocols, limits and message names
│       ├── storage.js       chrome.storage.local access, defaults, write queue
│       ├── proxy.js         chrome.proxy wrapper: configuration and control
│       └── validate.js      Input validation shared by popup and worker
├── popup/
│   ├── popup.html           Proxy list and add/edit form
│   ├── popup.css            Styling, including light and dark themes
│   └── popup.js             Rendering and event handling
├── icons/                   Colour and greyscale icons at 16/32/48/128 px
├── tools/
│   └── generate-icons.mjs   Icon generator
├── LICENSE
└── README.md

The separation is deliberate: the popup contains no proxy logic. It dispatches a message, the service worker mutates state and calls into Chrome, and the popup re-renders from the response. This maintains a single source of truth and prevents the interface and the browser from diverging.

Development

The extension requires no build tooling. Editing a source file and reloading the extension from chrome://extensions is sufficient.

The icons are committed to the repository. They may be regenerated with:

node tools/generate-icons.mjs

The generator describes the artwork as vector geometry and rasterises it with supersampling, using a PNG encoder built on the Node standard library. No image libraries or binary tooling are involved. The artwork is drawn in three tiers so that interior details are omitted at sizes where they would be thinner than a pixel, rather than downscaling a single bitmap into an unreadable result.

Verification

The service worker and popup were exercised together against a mocked chrome.* API, driving the production code paths through the real DOM.

Area Result
Creating, editing and deleting entries Passed; edits to the active proxy are propagated to Chrome immediately
Five-entry limit Enforced in the interface and independently in the service worker
Deleting an entry restores capacity Passed
Enabling applies the correct ProxyConfig Verified for HTTP, SOCKS4 and SOCKS5
Disabling releases control settings.clear() issued; levelOfControl returns to controllable
Changing selection while enabled Reapplied immediately
Changing selection while disabled Recorded without modifying Chrome
Deleting the active proxy Proxy released before removal; state reset to disabled
HTTP proxy with credentials Credentials supplied once per request
Rejected credentials Retry passed through, allowing Chrome to prompt rather than loop
Non-proxy authentication challenge Credentials withheld; never disclosed to a site
SOCKS proxy with credentials Withheld, with a warning shown in the form
Authentication while disabled No credentials supplied
Authentication listener without host access Not registered; registered on grant and removed on revocation
Browser restart Stored configuration reapplied; interface and icon restored
Loss of proxy control Interface disabled with an explanatory message; recovers when control is released
Proxy error reporting Fatal and non-fatal conditions distinguished; net:: code preserved
Concurrent state writes Serialised; a proxy error during a toggle no longer overwrites it
Input validation Empty name, scheme prefixes, embedded ports, malformed IPv4 addresses and out-of-range ports rejected inline
Toolbar icon Colour while enabled, greyscale while disabled, updated automatically

A mocked API cannot establish that a real proxy carries real traffic. Load the extension unpacked and confirm with an actual proxy server that pages load and that the expected egress address is observed.

License

Released under the MIT License.

About

A minimal Manifest V3 Chrome extension for managing and switching browser proxies from the toolbar. HTTP, SOCKS4 and SOCKS5, no dependencies, no backend.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages