Bagikan melalui


Kecualikan URL

Sekilas
Tujuan: Mencegah Proksi Dev mencegat URL tertentu
Waktu: 3 menit
Prasyarat:Menyiapkan Proksi Dev

Untuk mengecualikan URL agar tidak dicegat, tambahkan sebelumnya dengan tanda seru (!):

File: devproxyrc.json

{
  "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v2.1.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/*"
  ]
}

Dalam contoh di atas, proksi mengabaikan permintaan apa pun yang dibuat untuk /_api/web/GetClientSideComponents.

Saat mengecualikan URL, perlu diingat bahwa proksi mencari URL yang cocok dalam urutan yang ditentukan dalam konfigurasi.

Jika Anda ingin mengecualikan URL tertentu, Anda harus menentukannya terlebih dahulu, sebelum lebih banyak URL global cocok.

Lihat juga