Proxy 設定
開發 Proxy 隨附數個設定,可用來控制 Proxy 的執行方式。
您可以在位於 Proxy 安裝資料夾的 devproxyrc.json 檔案中設定這些設定,或透過命令行選項在執行時間設定這些設定。
下表說明設定。
設定 | 描述 | 命令列選項 | 允許的值 | 預設值 |
---|---|---|---|---|
apiPort |
要接聽之開發 Proxy API 的埠 | n/a | 整數 | 8897 |
asSystemProxy |
是否要在啟動時將開發 Proxy 註冊為系統 Proxy。 當 設定為 true 需要 installCert 時,請將 設定為 true |
--as-system-proxy |
true , false |
true |
filterByHeaders |
僅攔截具有特定標頭的要求 | n/a | {"filterByHeaders": [ { "name": "value" } ] } . 值可以是空的,以包含具有指定標頭的要求,無論其值為何。 |
n/a |
installCert |
是否安裝跟證書 | --install-cert |
true , false |
true |
ipAddress |
要系結至之 Proxy 的IP位址 | --ip-address <ipAddress> |
IPv4 位址 | 127.0.0.1 |
languageModel |
語言模型的設定 | n/a | 如需詳細資訊, 請參閱語言模型 一節。 | n/a |
logLevel |
要記錄的訊息層級 | --log-level <loglevel> |
trace 、、 debug 、 information 、 warning 、 error |
information |
newVersionNotification |
是否要通知新版本 | n/a | none 、 、 stable beta |
stable |
n/a | 略過第一次執行體驗(不信任 macOS 上的憑證) | --no-first-run |
n/a | n/a |
port |
要接聽之 Proxy 伺服器的埠 | -p, --port <port> |
整數 | 8000 |
rate |
Proxy 失敗要求的機會百分比。 設定為 0 以將所有要求傳遞至 API,並將設為 100 失敗所有要求。 |
-f, --failure-rate <failurerate> |
0..100 |
50 |
record |
使用此選項來記錄所有要求記錄 | --record |
n/a | n/a |
showSkipMessages |
當 Dev Proxy 略過執行外掛程式時,是否要顯示記錄訊息。 | n/a | true , false |
true |
urlsToWatch |
Proxy 應攔截的 URL 清單 | -u, --urls-to-watch <urlsToWatch> |
例如,絕對 URL (可包含通配符) "https://api.contoso.com/*" |
請參閱 devproxyrc 檔案 |
n/a | 要監看要求之程式的標識碼 | --watch-pids <pids> |
整數 | n/a |
n/a | 要監看要求的進程名稱 | --watch-process-names <processNames> |
字串 | n/a |