Windows でプロキシと除外を設定する
このガイドでは、IP ベースのプロキシ定義とWebSocket アプリの互換性に注意しながら、Windows でプロキシ設定とバイパス除外を構成する方法を説明します。
WebSockets に依存する一般的なアプリ:
- Slack
- Figma
- Lucidchart
これらは、Squid のような、wss://接続をサポートしていないプロキシ経由でルーティングされると失敗することがあります。
このスクリプトの動作
- PowerShell を使用してシステム全体のプロキシ IP アドレスを設定します
- ユーザー アプリ (WinINET) と システム サービス (WinHTTP) に除外設定を適用します
- WebSocket ベースのアプリおよび Microsoft サービスでプロキシ ルーティングを防止します
- Intune、GPO、または手動スクリプト実行による展開をサポートします
手動設定手順
- Control Panel → Internet Options を起動します。
- Connections タブ → LAN Settings に移動します。
- Use a proxy server を有効にします。
- Set:
- Address =
192.168.1.10 - Port =
8080
- Address =
- Advanced をクリックし、以下のドメインを Exceptions リストに追加します。
- 適用して保存します。
スクリプトによる方法(PowerShell)
# Define proxy IP and port
$proxyIP = "http://192.168.1.10:8080"
# Define proxy bypass list
$bypassList = "localhost;127.0.0.1;*.microsoftonline.com;*.core.windows.net;*.slack.com;*.figma.com;*.lucidchart.com;*.lucid.app;*.github.com;copilot-proxy.githubusercontent.com"
# Apply proxy for system services
netsh winhttp set proxy $proxyIP ";$bypassList"
# Apply proxy for user apps
$regPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
Set-ItemProperty -Path $regPath -Name ProxyEnable -Value 1
Set-ItemProperty -Path $regPath -Name ProxyServer -Value $proxyIP
Set-ItemProperty -Path $regPath -Name ProxyOverride -Value $bypassList