Web.DefaultProxy is a Power Query M function that retrieves the system’s default proxy settings used for HTTP requests.
Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365
Syntax
Web.DefaultProxy( uri as text ) as nullable record
Examples
Let’s look at an example that uses Web.DefaultProxy:
UseWebDefaultProxyOption = options[UseWebDefaultProxy]?,
ProxyUriRecord = if UseWebDefaultProxyOption then Web.DefaultProxy(Host) else null,
ProxyOptions = if Record.FieldCount(ProxyUriRecord) > 0 then
[
Proxy = ProxyUriRecord[ProxyUri]
]
else [],
...
This code snippet is setting up proxy options for web requests based on user-defined settings. Here’s what it does in simple terms:
- Checks User Settings: It looks at the
options[UseWebDefaultProxy]
setting to determine if the default web proxy should be used. - Gets Proxy Information: If the default proxy is enabled, it retrieves the proxy details using
Web.DefaultProxy(Host)
. - Parses Proxy Details: If a proxy is found, the
Uri.Parts
function is used to break down the proxy’s details (like its scheme, host, and port). - Configures Proxy Options: If the proxy details are valid, it builds a record containing the proxy host and port. If no proxy is being used, it leaves the options empty.
In short, this setup dynamically determines whether to use a proxy and gathers the necessary details to configure it for web requests.
Related articles
Learn more about Web.DefaultProxy in the following articles:
- Handling proxy support
This article describes how you can enable proxy support in your Power Query custom connector using the Power Query SDK. » Read more
Related functions
Other functions related to Web.DefaultProxy are:
2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy