openharmony 鸿蒙 arkts-apis-webview-ProxyConfig

2026-08-25 浏览 (1)

Class (ProxyConfig)

Implements a ProxyConfig object to configure proxies.

NOTE

  • The initial APIs of this module are supported since API version 9. Updates will be marked with a superscript to indicate their earliest API version.

  • The initial APIs of this class are supported since API version 15.

  • The sample effect is subject to the actual device.

insertProxyRule15+

insertProxyRule(proxyRule: string, schemeFilter?: ProxySchemeFilter): void

Inserts a proxy rule for URLs matching schemeFilter. If schemeFilter is empty, all URLs use the specified proxy.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameTypeMandatoryDescription
proxyRulestringYesThe specified proxy.
schemeFilterProxySchemeFilterNoFilter used to specify URLs that use the proxy.
Default value: MATCH_ALL_SCHEMES.
If undefined or null is passed, error code 401 will be thrown.

Error codes

For details about the following error codes, see Universal Error Codes.

Error CodeError Message
401Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.

Example

For details about the sample code, see removeProxyOverride.

insertDirectRule15+

insertDirectRule(schemeFilter?: ProxySchemeFilter): void

Inserts a proxy rule to specify that URLs matching schemeFilter are directly connected to the server.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameTypeMandatoryDescription
schemeFilterProxySchemeFilterNoFilter used to specify URLs to be directly connected to the server.
Default value: MATCH_ALL_SCHEMES.
If undefined or null is passed, error code 401 will be thrown.

Error codes

For details about the following error codes, see Universal Error Codes.

Error CodeError Message
401Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.

Example

For details about the sample code, see removeProxyOverride.

insertBypassRule15+

insertBypassRule(bypassRule: string): void

Inserts a bypass rule to specify the URLs that should bypass the proxy and directly connect to the server.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameTypeMandatoryDescription
bypassRulestringYesBypass rule used to specify the URLs that should bypass the proxy.

Error codes

For details about the following error codes, see Universal Error Codes.

Error CodeError Message
401Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.

Example

For details about the sample code, see removeProxyOverride.

bypassHostnamesWithoutPeriod15+

bypassHostnamesWithoutPeriod(): void

Specifies that host names without a period should bypass the proxy and directly connect to the server.

System capability: SystemCapability.Web.Webview.Core

Example

For details about the sample code, see removeProxyOverride.

clearImplicitRules15+

clearImplicitRules(): void

Overrides the default behavior and forcibly sends the local host address or local IP address through the proxy. (By default, if host names are local IP addresses or local host addresses, they bypass the proxy.)

System capability: SystemCapability.Web.Webview.Core

Example

For details about the sample code, see removeProxyOverride.

enableReverseBypass15+

enableReverseBypass(reverse: boolean): void

Reverses the bypass rule.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameTypeMandatoryDescription
reversebooleanYesWhether to reverse the bypass rule. The default value is false, indicating the bypass rule set in insertBypassRule is not reversed. The value true indicates the opposite.

Error codes

For details about the following error codes, see Universal Error Codes.

Error CodeError Message
401Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.

Example

For details about the sample code, see removeProxyOverride.

getBypassRules15+

getBypassRules(): Array<string>

Obtains the list of URLs that do not use the proxy.

System capability: SystemCapability.Web.Webview.Core

Return value

TypeDescription
Array<string>List of URLs that do not use the proxy.

Example

For details about the sample code, see removeProxyOverride.

getProxyRules15+

getProxyRules(): Array<ProxyRule>

Obtains proxy rules.

System capability: SystemCapability.Web.Webview.Core

Return value

TypeDescription
Array<ProxyRule>Proxy rules.

Example

For details about the sample code, see removeProxyOverride.

isReverseBypassEnabled15+

isReverseBypassEnabled(): boolean

Obtains the value of enableReverseBypass. For details, see enableReverseBypass.

System capability: SystemCapability.Web.Webview.Core

Return value

TypeDescription
booleanValue of enableReverseBypass. The default value is false, indicating the bypass rule set in insertBypassRule is not reversed. The value true indicates the opposite.

Example

For details about the sample code, see removeProxyOverride.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 arkts-apis-webview-WebviewController

openharmony 鸿蒙 arkts-apis-webview-t

openharmony 鸿蒙 arkts-apis-webview

openharmony 鸿蒙 capi-arkweb-type-h

openharmony 鸿蒙 arkts-basic-components-web-FullScreenExitHandler

openharmony 鸿蒙 arkts-apis-webview-WebDownloadManager

openharmony 鸿蒙 arkts-basic-components-web-VerifyPinHandler

openharmony 鸿蒙 capi-web-arkweb-webmessage8h

openharmony 鸿蒙 arkts-apis-webview-NativeMediaPlayerHandler

openharmony 鸿蒙 capi-web-arkweb-proxymethodwithresult

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/uHk50iZR