Skip to content

Invoke-TlsWebRequest - Auto-detect system proxy#10310

Open
andreasjordan wants to merge 2 commits intodevelopmentfrom
claude/issue-5884-20260404-1730
Open

Invoke-TlsWebRequest - Auto-detect system proxy#10310
andreasjordan wants to merge 2 commits intodevelopmentfrom
claude/issue-5884-20260404-1730

Conversation

@andreasjordan
Copy link
Copy Markdown
Collaborator

Adds automatic proxy detection to Invoke-TlsWebRequest using [System.Net.WebRequest]::GetSystemWebProxy(). When no proxy is already configured, the system proxy is detected and set with default network credentials. Supports PAC files and is cross-platform. All callers benefit without individual changes.

Fixes #5884

Generated with Claude Code

…xy()

Adds automatic proxy detection to Invoke-TlsWebRequest by calling
[System.Net.WebRequest]::GetSystemWebProxy() when no proxy is already
configured. This provides PAC file support and cross-platform compatibility
(PS7 on Linux/macOS uses HTTP_PROXY/HTTPS_PROXY env vars; PS5.1 on Windows
uses WinINET). All callers benefit without individual changes.

Fixes #5884

(do *Web*)

Co-authored-by: Andreas Jordan <andreasjordan@users.noreply.github.com>
@potatoqualitee
Copy link
Copy Markdown
Member

looking forward to this one 👍🏼

@andreasjordan
Copy link
Copy Markdown
Collaborator Author

@claude please create a config item to opt out like Chrissy sugessted in the issue.

@claude
Copy link
Copy Markdown

claude bot commented Apr 5, 2026

Claude finished @andreasjordan's task in 1m 58s —— View job


Added opt-out config item

  • Read current implementation
  • Check config system patterns
  • Add config entry to commands.ps1
  • Update Invoke-TlsWebRequest.ps1 to honor the config
  • Commit and push changes

Changes made:

private/configurations/settings/commands.ps1 — new config entry:

Set-DbatoolsConfig -FullName 'commands.invoke-tlswebrequest.disableautoproxy' -Value $false -Initialize -Validation bool -Description "Disable automatic system proxy detection in Invoke-TlsWebRequest. Set to true to skip auto-detection of the system proxy (useful if auto-detection causes issues in your environment)."

private/functions/Invoke-TlsWebRequest.ps1 — honors the config:

# Auto-detect system proxy if not already configured and not opted out
if (-not (Get-DbatoolsConfigValue -FullName "commands.invoke-tlswebrequest.disableautoproxy") -and -not [System.Net.WebRequest]::DefaultWebProxy.Address) {

Users who want to opt out can run:

Set-DbatoolsConfig -FullName 'commands.invoke-tlswebrequest.disableautoproxy' -Value $true

|

(do Invoke-TlsWebRequest)

Co-authored-by: Andreas Jordan <andreasjordan@users.noreply.github.com>
@andreasjordan andreasjordan marked this pull request as ready for review April 5, 2026 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Discussion: Autodetect Proxy Server and set in Invoke-TlsWebRequest?

2 participants