共用方式為


排除 URL

一目了然
目標: 防止開發代理攔截特定網址
時間: 3分鐘
前置條件:設定開發代理

若要排除 URL 不受攔截,請在前面加上 ! (驚嘆號):

檔案: devproxyrc.json

{
  "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v2.0.0/rc.schema.json",
  "plugins": [
    {
      "name": "GenericRandomErrorPlugin",
      "enabled": true,
      "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll"
    }
  ],
  "urlsToWatch": [
    "https://graph.microsoft.com/v1.0/*",
    "https://graph.microsoft.com/beta/*",
    "https://graph.microsoft.us/v1.0/*",
    "https://graph.microsoft.us/beta/*",
    "https://dod-graph.microsoft.us/v1.0/*",
    "https://dod-graph.microsoft.us/beta/*",
    "https://microsoftgraph.chinacloudapi.cn/v1.0/*",
    "https://microsoftgraph.chinacloudapi.cn/beta/*",
    "!https://*.sharepoint.*/*_api/web/GetClientSideComponents",
    "https://*.sharepoint.*/*_api/*",
    "https://*.sharepoint.*/*_vti_bin/*",
    "https://*.sharepoint-df.*/*_api/*",
    "https://*.sharepoint-df.*/*_vti_bin/*"
  ]
}

在上述範例中,Proxy 會忽略對 /_api/web/GetClientSideComponents所做的任何要求。

排除 URL 時,請記住 Proxy 會依組態中定義 URL 的順序尋找相符的 URL。

如果您想要排除特定 URL,您應該先定義它們,再進行更全面的 URL 比對。

另請參閱