Cov txheej txheem:

Dab tsi yog nrog Daim Ntawv Pov Thawj muaj tseeb?
Dab tsi yog nrog Daim Ntawv Pov Thawj muaj tseeb?

Video: Dab tsi yog nrog Daim Ntawv Pov Thawj muaj tseeb?

Video: Dab tsi yog nrog Daim Ntawv Pov Thawj muaj tseeb?
Video: Leng Yang - Yog Vim Dab Tsi (Official Full Song | Nkauj Tawm Tshiab) 2020/05/24 2024, Kaum ib hlis
Anonim

XMLHttpRequest. nrog daim ntawv pov thawj Cov cuab yeej yog Boolean uas qhia seb puas yuav tsum tau siv cov kev thov hla kev nkag-Control cov ntaub ntawv pov thawj xws li ncuav qab zib, daim ntawv tso cai headers los yog TLS tus neeg siv daim ntawv pov thawj. Tsis tas li ntawd, tus chij no kuj tseem siv los qhia thaum lub ncuav qab zib yuav tsum tsis quav ntsej hauv cov lus teb.

Hauv qhov no, Cors siv rau dab tsi?

Kev sib faib cov peev txheej hla keeb kwm ( CORS ) yog W3C spec uas tso cai rau kev sib txuas lus hla ntawm tus browser. Los ntawm kev tsim nyob rau sab saum toj ntawm XMLHttpRequest object, CORS tso cai rau cov neeg tsim khoom ua haujlwm nrog tib lub idioms raws li tib lub npe thov. Cov siv - cas rau CORS yog qhov yooj yim.

Qhov thib ob, CORS yog dab tsi thiab nws ua haujlwm li cas? Kev sib faib cov peev txheej hla keeb kwm ( CORS ) yog ib lub tswv yim uas siv HTTP headers ntxiv los qhia rau cov browsers kom muab cov ntawv thov web khiav ntawm ib lub hauv paus, nkag mus rau cov kev xaiv los ntawm lwm lub hauv paus chiv keeb.

Tom qab ntawd, daim ntawv pov thawj tib yam yog dab tsi?

ib yam - keeb kwm : Xa neeg siv cov ntaub ntawv pov thawj (cov ncuav qab zib, qhov yooj yim http auth, thiab lwm yam..) yog tias qhov URL nyob rau ntawm tib lub hauv paus raws li tsab ntawv hu. Qhov no yog tus nqi qub. suav nrog: Ib txwm xa cov neeg siv cov ntaub ntawv pov thawj (cov ncuav qab zib, qhov yooj yim http auth, thiab lwm yam.), txawm tias hla- keeb kwm hu.

Koj yuav kho qhov teeb meem CORS li cas?

Txoj hauv kev los kho qhov teeb meem no muaj xws li:

  1. Ntxiv kev txhawb nqa ntawm OPTIONS txoj kev kom CORS preflight thov siv tau.
  2. Ntxiv rau Access-Control-Allow-Origin header hauv koj cov lus teb kom lub browser tuaj yeem tshawb xyuas qhov kev thov siv tau.

Pom zoo: