Use the proxy API to proxy web requests. There are two different ways you can do this:

The advantage of the PAC file approach is that if you already have a PAC file it's relatively easy to use it in the WebExtensions framework.

The advantage of the proxy.onRequest approach is that the code that implements your proxy policy runs in your extension's background script, so it gets full access to the WebExtension APIs available to your extension (including, for example, access to your extension's storage and networking APIs like dns).

Apart from this API, extensions can also use the browserSettings.proxyConfig property to configure global proxy settings.

Google Chrome provides an extension API also called "proxy" which is functionally similar to this API, in that extensions can use it to implement a proxying policy. However, the design of the Chrome API is completely different to this API. Because this API is incompatible with the Chrome proxy API, this API is only available through the browser namespace.

To use this API you need to have the "proxy" permission.

Types

proxy.ProxyInfo
Describes a proxy.
proxy.RequestDetails

Contains information about a web request that the browser is about to make.

Properties

proxy.settings
Get and set proxy settings.

Functions

proxy.register()
Registers the given proxy script.
proxy.unregister()
Unregisters the proxy script.

Events

proxy.onError
Fired when the system encounters an error running the PAC script or the onRequest listener.
proxy.onRequest
Fired when a web request is about to be made, giving the extension an opportunity to proxy it.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxOperaFirefox for Android
onErrorChrome No support NoEdge No support NoFirefox Full support 60
Full support 60
Full support 55
Alternate Name
Alternate Name Uses the non-standard name: onProxyError
Opera No support NoFirefox Android Full support 60
Full support 60
Full support 55
Alternate Name
Alternate Name Uses the non-standard name: onProxyError
onRequestChrome No support NoEdge No support NoFirefox Full support 60Opera No support NoFirefox Android Full support 60
ProxyInfoChrome No support NoEdge No support NoFirefox Full support 60Opera No support NoFirefox Android Full support 60
RequestDetailsChrome No support NoEdge No support NoFirefox Full support 60Opera No support NoFirefox Android Full support 60
registerChrome No support NoEdge No support NoFirefox Full support 56
Full support 56
Full support 55
Alternate Name
Alternate Name Uses the non-standard name: registerProxyScript
Opera No support NoFirefox Android Full support 56
Full support 56
Full support 55
Alternate Name
Alternate Name Uses the non-standard name: registerProxyScript
settingsChrome No support NoEdge No support NoFirefox Full support 60
Notes
Full support 60
Notes
Notes In version 59, this property was listed as proxyConfig in the browserSettings namespace, but had a bug that made it mostly unusable.
Opera No support NoFirefox Android No support No
unregisterChrome No support NoEdge No support NoFirefox Full support 56Opera No support NoFirefox Android Full support 56

Legend

Full support  
Full support
No support  
No support
See implementation notes.
See implementation notes.
Uses a non-standard name.
Uses a non-standard name.

Example extensions

Document Tags and Contributors

Contributors to this page: wbamberg, ericjung, vorwrath, yfdyh000, andrewtruongmoz, mwein
Last updated by: wbamberg,