Cov txheej txheem:

Leej twg tiv thaiv Cors?
Leej twg tiv thaiv Cors?

Video: Leej twg tiv thaiv Cors?

Video: Leej twg tiv thaiv Cors?
Video: leej twg tej ntxhai - Mang Vang [ Official MV ] 2024, Kaum ib hlis
Anonim

Hauv paus CORS tso cai rau koj lub vev xaib js frontend code nkag mus rau koj lub vev xaib backend nrog cov ncuav qab zib thiab cov ntaub ntawv pov thawj nkag rau hauv koj tus browser thaum koj qhov backend nyob. tiv thaiv los ntawm qee lub vev xaib js, nug tus neeg siv browser kom nkag mus rau nws (nrog cov ntaub ntawv pov thawj tus neeg siv tau txais).

Ib yam li ib tug yuav nug, Cors tiv thaiv dab tsi?

CORS yog npaj los tso cai rau cov tswv cuab (txhua qhov kev pabcuam uas ua rau nws cov ntaub ntawv muaj nyob ntawm HTTP) txwv tsis pub lub vev xaib twg tuaj yeem nkag mus rau cov ntaub ntawv ntawd. Piv txwv: Koj tab tom tuav lub vev xaib uas qhia cov ntaub ntawv tsheb khiav thiab koj siv AJAX thov ntawm koj lub vev xaib.

Tsis tas li ntawd, lub ntsiab lus ntawm Cors yog dab tsi? Lub hom phiaj ntawm CORS yog tiv thaiv lub web browser uas hwm nws los ntawm kev hu rau tus neeg rau zaub mov uas tsis yog tus qauv thov nrog cov ntsiab lus tau txais los ntawm qhov chaw sib txawv.

Ib sab saum toj, 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.

Koj ua li cas siv CORS?

Rau IIS6

  1. Qhib Internet Information Service (IIS) Manager.
  2. Txoj nyem rau ntawm qhov chaw koj xav kom pab CORS rau thiab mus rau Properties.
  3. Hloov mus rau HTTP Headers tab.
  4. Hauv Custom HTTP headers section, nyem Ntxiv.
  5. Nkag mus rau Access-Control-Allow-Origin raws li lub npe header.
  6. Sau * raws li tus nqi header.
  7. Nyem Ok ob zaug.

Pom zoo: