pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

<legend id='hFgsv'><style id='hFgsv'><dir id='hFgsv'><q id='hFgsv'></q></dir></style></legend>

    <tfoot id='hFgsv'></tfoot>
      • <bdo id='hFgsv'></bdo><ul id='hFgsv'></ul>

      <i id='hFgsv'><tr id='hFgsv'><dt id='hFgsv'><q id='hFgsv'><span id='hFgsv'><b id='hFgsv'><form id='hFgsv'><ins id='hFgsv'></ins><ul id='hFgsv'></ul><sub id='hFgsv'></sub></form><legend id='hFgsv'></legend><bdo id='hFgsv'><pre id='hFgsv'><center id='hFgsv'></center></pre></bdo></b><th id='hFgsv'></th></span></q></dt></tr></i><div class="w2ceoa0" id='hFgsv'><tfoot id='hFgsv'></tfoot><dl id='hFgsv'><fieldset id='hFgsv'></fieldset></dl></div>

      <small id='hFgsv'></small><noframes id='hFgsv'>

        為什么禁止沒有憑據的 CORS?

        Why is CORS without credentials forbidden?(為什么禁止沒有憑據的 CORS?)
          <tbody id='VnSNr'></tbody>
            <bdo id='VnSNr'></bdo><ul id='VnSNr'></ul>
            <tfoot id='VnSNr'></tfoot>
          • <i id='VnSNr'><tr id='VnSNr'><dt id='VnSNr'><q id='VnSNr'><span id='VnSNr'><b id='VnSNr'><form id='VnSNr'><ins id='VnSNr'></ins><ul id='VnSNr'></ul><sub id='VnSNr'></sub></form><legend id='VnSNr'></legend><bdo id='VnSNr'><pre id='VnSNr'><center id='VnSNr'></center></pre></bdo></b><th id='VnSNr'></th></span></q></dt></tr></i><div class="ige2mkc" id='VnSNr'><tfoot id='VnSNr'></tfoot><dl id='VnSNr'><fieldset id='VnSNr'></fieldset></dl></div>

            1. <legend id='VnSNr'><style id='VnSNr'><dir id='VnSNr'><q id='VnSNr'></q></dir></style></legend>

              <small id='VnSNr'></small><noframes id='VnSNr'>

                  本文介紹了為什么禁止沒有憑據的 CORS?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我試圖理解為什么不允許沒有憑據的跨域請求(默認情況下,沒有設置服務器來返回 Access-Control-Allow-Origin 標頭).當請求具有憑據時,一切都非常簡單 - 如果您已登錄,則可以代表您在其他網站上執行一些惡意操作,例如在 Facebook 上.

                  I'm trying to understand why cross-domain requests without credentials are not allowed (by default, without setting up a server to return the Access-Control-Allow-Origin header). When a request has credentials all is pretty straightforward - one can fulfill some malicious actions on your behalf on other sites, for example on Facebook, if you have logged in on it.

                  例如請求

                  xhr = new XMLHttpRequest();
                  xhr.open('GET', 'http://www.google.com');
                  xhr.send();
                  

                  產生錯誤(我從這個站點在 Chrome 的控制臺中執行它):

                  produces the error (I executed it in Chrome's console from this site):

                  XMLHttpRequest 無法加載 http://www.google.com/.不請求中存在Access-Control-Allow-Origin"標頭資源.因此,來源 'http://stackoverflow.com' 是不允許的訪問.

                  XMLHttpRequest cannot load http://www.google.com/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://stackoverflow.com' is therefore not allowed access.

                  因此,服務器必須發送適當的標頭(例如 Access-Control-Allow-Origin: * )才能使該請求起作用.

                  So, the server must send an appropriate header (e.g Access-Control-Allow-Origin: * ) to this request can work.

                  這只是一個簡單的請求,不會發送任何 cookie.這種限制的原因是什么?如果允許此類 CORS,可能會出現哪些安全問題?

                  This is just a simple request and no cookies are sent. What's the reason for such a restriction? What security issues might take place if such CORS will be allowed?

                  沒有憑據 - 沒有 cookie:XMLHTTPRequest 的默認設置是 withCredentials = false,因此請求中不會發送任何 cookie - 鏈接.

                  without credentials - without cookies: default settings for XMLHTTPRequest is withCredentials = false, so no cookies are sent in the request - link.

                  推薦答案

                  我會繼續從 Security.SE 的 為什么需要 Access-Control-Allow-Origin 標頭?

                  I'll go ahead and liberally steal from Security.SE's Why is the Access-Control-Allow-Origin header necessary?

                  這里主要關注的是基于網絡拓撲的訪問控制.假設您在家庭網絡上運行 HTTP 服務(事實上,如果您的路由器本身具有 Web 界面,您幾乎肯定會這樣做).我們將此服務稱為 R,只有連接到家庭路由器的機器才能訪問該服務.

                  The main concern here is access control based on network topology. Suppose you run a HTTP service on your home network (in fact, you almost certainly do, if your router itself has a Web interface). We'll call this service R, and the only machines connected to your home router can get to the service.

                  當您的瀏覽器訪問 evil.example.com 時,該站點會為您的瀏覽器提供一個腳本,告訴它獲取 R 的內容并將其發送回 evil.example.com.即使沒有憑據,這也可能很糟糕,因為它違反了本地網絡之外的任何人都無法查看本地網絡內運行的服務的假設.同源策略阻止了這種情況的發生.如果同源策略僅在涉及憑據時發揮作用,則可能會繞過基于拓撲的保護.

                  When your browser visits evil.example.com, that site serves your browser a script, telling it to fetch the contents of R and send it back to evil.example.com. This is potentially bad, even without credentials, because it's a violation of the assumption that no one outside your local network can view the services running inside your local network. The same-origin policy stops this from happening. If the same-origin policy only came into play when credentials were involved, it would opens up the possibility of bypassing topology-based protections.

                  還要考慮一些公共服務允許基于 IP 地址的訪問:

                  Consider also that some public services allow access based on IP address:

                  • 牛津英語詞典將其在線條目的訪問權限限制為來自訂閱大學的 IP 地址
                  • 英國將 BBC 內容的訪問權限限制在國內的 IP 地址內

                  在此處列出的所有情況下,瀏覽器都可能被用作任何為其提供腳本的網站的不知情代理.

                  In all of the cases listed here, a browser could be used as an unwitting proxy for any site that serves it a script.

                  這篇關于為什么禁止沒有憑據的 CORS?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調用 abort (jQuery) 之后,瀏覽器也會等待 ajax 調用完成)
                  JavaScript innerHTML is not working for IE?(JavaScript innerHTML 不適用于 IE?)
                  XMLHttpRequest cannot load, No #39;Access-Control-Allow-Origin#39; header is present on the requested resource(XMLHttpRequest 無法加載,請求的資源上不存在“Access-Control-Allow-Origin標頭) - IT屋-程序員軟件開發技術分
                  Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 請求是否有可能不遵循重定向 (301 302))
                  NETWORK_ERROR: XMLHttpRequest Exception 101(NETWORK_ERROR:XMLHttpRequest 異常 101)
                  XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分內容)
                  <tfoot id='KEWQr'></tfoot>

                      <bdo id='KEWQr'></bdo><ul id='KEWQr'></ul>

                        <legend id='KEWQr'><style id='KEWQr'><dir id='KEWQr'><q id='KEWQr'></q></dir></style></legend>
                          <tbody id='KEWQr'></tbody>

                            <small id='KEWQr'></small><noframes id='KEWQr'>

                            <i id='KEWQr'><tr id='KEWQr'><dt id='KEWQr'><q id='KEWQr'><span id='KEWQr'><b id='KEWQr'><form id='KEWQr'><ins id='KEWQr'></ins><ul id='KEWQr'></ul><sub id='KEWQr'></sub></form><legend id='KEWQr'></legend><bdo id='KEWQr'><pre id='KEWQr'><center id='KEWQr'></center></pre></bdo></b><th id='KEWQr'></th></span></q></dt></tr></i><div class="oececcg" id='KEWQr'><tfoot id='KEWQr'></tfoot><dl id='KEWQr'><fieldset id='KEWQr'></fieldset></dl></div>
                            主站蜘蛛池模板: 成都茶楼装修公司 - 会所设计/KTV装修 - 成都朗煜装饰公司 | 必胜高考网_全国高考备考和志愿填报信息平台 | 防爆型气象站_农业气象站_校园气象站_农业四情监测系统「山东万象环境科技有限公司」 | 磨煤机配件-高铬辊套-高铬衬板-立磨辊套-盐山县宏润电力设备有限公司 | 电气控制系统集成商-PLC控制柜变频控制柜-非标自动化定制-电气控制柜成套-NIDEC CT变频器-威肯自动化控制 | 液压油缸-液压缸厂家价格,液压站系统-山东国立液压制造有限公司 液压油缸生产厂家-山东液压站-济南捷兴液压机电设备有限公司 | H型钢切割机,相贯线切割机,数控钻床,数控平面钻,钢结构设备,槽钢切割机,角钢切割机,翻转机,拼焊矫一体机 | 安平县鑫川金属丝网制品有限公司,防风抑尘网,单峰防风抑尘,不锈钢防风抑尘网,铝板防风抑尘网,镀铝锌防风抑尘网 | 预制围墙_工程预制围墙_天津市瑞通建筑材料有限公司 | 蔡司三坐标-影像测量机-3D扫描仪-蔡司显微镜-扫描电镜-工业CT-ZEISS授权代理商三本工业测量 | 科研ELISA试剂盒,酶联免疫检测试剂盒,昆虫_植物ELISA酶免试剂盒-上海仁捷生物科技有限公司 | uv机-uv灯-uvled光固化机-生产厂家-蓝盾机电 | 空气能暖气片,暖气片厂家,山东暖气片,临沂暖气片-临沂永超暖通设备有限公司 | 衡阳耐适防护科技有限公司——威仕盾焊接防护用品官网/焊工手套/焊接防护服/皮革防护手套 | 沈阳缠绕膜价格_沈阳拉伸膜厂家_沈阳缠绕膜厂家直销 | 液晶拼接屏厂家_拼接屏品牌_拼接屏价格_监控大屏—北京维康 | 数控专用机床,专用机床,自动线,组合机床,动力头,自动化加工生产线,江苏海鑫机床有限公司 | 全自动包装秤_全自动上袋机_全自动套袋机_高位码垛机_全自动包装码垛系统生产线-三维汉界机器(山东)股份有限公司 | 山东风淋室_201/304不锈钢风淋室净化设备厂家-盛之源风淋室厂家 翻斗式矿车|固定式矿车|曲轨侧卸式矿车|梭式矿车|矿车配件-山东卓力矿车生产厂家 | 广东护栏厂家-广州护栏网厂家-广东省安麦斯交通设施有限公司 | 注塑机-压铸机-塑料注塑机-卧式注塑机-高速注塑机-单缸注塑机厂家-广东联升精密智能装备科技有限公司 | 双舌接地线-PC68数字式高阻计-ZC36|苏海百科 | 本安接线盒-本安电路用接线盒-本安分线盒-矿用电话接线盒-JHH生产厂家-宁波龙亿电子科技有限公司 | 京马网,京马建站,网站定制,营销型网站建设,东莞建站,东莞网站建设-首页-京马网 | 小型玉石雕刻机_家用玉雕机_小型万能雕刻机_凡刻雕刻机官网 | 长沙广告公司|长沙广告制作设计|长沙led灯箱招牌制作找望城湖南锦蓝广告装饰工程有限公司 | 酒店品牌设计-酒店vi设计-酒店标识设计【国际级】VI策划公司 | 小型气象站_车载气象站_便携气象站-山东风途物联网 | 对夹式止回阀_对夹式蝶形止回阀_对夹式软密封止回阀_超薄型止回阀_不锈钢底阀-温州上炬阀门科技有限公司 | 临沂招聘网_人才市场_招聘信息_求职招聘找工作请认准【马头商标】 | 拉力机-拉力试验机-万能试验机-电子拉力机-拉伸试验机-剥离强度试验机-苏州皖仪实验仪器有限公司 | 气胀轴|气涨轴|安全夹头|安全卡盘|伺服纠偏系统厂家-天机传动 | 贝朗斯动力商城(BRCPOWER.COM) - 买叉车蓄电池上贝朗斯商城,价格更超值,品质有保障! | 沈阳建筑设计公司_加固改造设计_厂房设计_设计资质加盟【金辉设计】 | 磁力抛光机_磁力研磨机_磁力去毛刺机-冠古设备厂家|维修|租赁【官网】 | 厌氧工作站-通用型厌氧工作站-上海胜秋科学仪器有限公司 | YT保温材料_YT无机保温砂浆_外墙保温材料_南阳银通节能建材高新技术开发有限公司 | 吉林污水处理公司,长春工业污水处理设备,净水设备-长春易洁环保科技有限公司 | 安全阀_弹簧式安全阀_美标安全阀_工业冷冻安全阀厂家-中国·阿司米阀门有限公司 | 温室大棚建设|水肥一体化|物联网系统 | 上海办公室装修,写字楼装修—启鸣装饰设计工程有限公司 |