Ku-PAC, i-shExpMatch isebenzisa ama-wildcards ohlobo lwe-shell. Kuma-subdomain we-example.com:

if (shExpMatch(host, "*.example.com")) {
    return "PROXY proxy.example:8080";
}

Sebenzisa ama-endpoint e-HTTP akhethwe yinqubomgomo kulawo manani okubuyisela; uhlu lwe-proxy ye-HTTP lunikeza abazongenela imigwaqo yomphakathi evunyelwe. Inkanyezi ihambisana nochungechunge lwezinhlamvu. Akuwona umsebenzi wokuphinda we-regex, ngakho i-.*example.com efana ne-regex ishintsha incazelo.

Faka igama eliphelele lomzali ngokusobala lapho liyingxenye yenqubomgomo:

if (host === "example.com" || shExpMatch(host, "*.example.com")) {
    return "PROXY proxy.example:8080";
}

Ukusebenzisa i-*example.com esikhundleni kuzokwamukela namagama aphela ngalezo zinhlamvu ngaphandle kwephuzu elihlukanisayo. Lokho kwandisa isethi idlule umngcele wesizinda ohlosiwe.

Isisekelo se-wildcards se-PAC esithathwayo sihlanganisa i-* ne-?; izigaba zezinhlamvu ziyahluka ngokuya ngokusetshenziswa. I-regex ye-JavaScript isebenzisa i-test() nemithetho yayo yokubambelela nokuphunyuka esikhundleni salokho.

Hambisana nokokufaka okuhlosiwe. I-host iyigama lomsingathi, kuyilapho i-url ihlanganisa isu futhi kungenzeka ukuthi ihlanjululwe. Umthetho wesizinda akufanele uncike ngengozi endleleni isiphequluli esingayinikezi neze.

Izihloko ezihlobene