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>
                            主站蜘蛛池模板: 运动木地板价格,篮球馆体育运动木地板生产厂家_欧氏地板 | 上海冠顶工业设备有限公司-隧道炉,烘箱,UV固化机,涂装设备,高温炉,工业机器人生产厂家 | 硫化罐-电加热蒸汽硫化罐生产厂家-山东鑫泰鑫智能装备有限公司 | 上海质量认证办理中心| 全球化工设备网—化工设备,化工机械,制药设备,环保设备的专业网络市场。 | 威廉希尔WilliamHill·足球(中国)体育官方网站 | 脉冲除尘器,除尘器厂家-淄博机械 | 外观设计_设备外观设计_外观设计公司_产品外观设计_机械设备外观设计_东莞工业设计公司-意品深蓝 | 真空乳化机-灌装封尾机-首页-温州精灌 | 厌氧工作站-通用型厌氧工作站-上海胜秋科学仪器有限公司 | 防爆型气象站_农业气象站_校园气象站_农业四情监测系统「山东万象环境科技有限公司」 | 铝箔-铝板-花纹铝板-铝型材-铝棒管-上海百亚金属材料有限公司 | 不锈钢闸阀_球阀_蝶阀_止回阀_调节阀_截止阀-可拉伐阀门(上海)有限公司 | 广东护栏厂家-广州护栏网厂家-广东省安麦斯交通设施有限公司 | 517瓜水果特产网|一个专注特产好物的网站| 东莞市海宝机械有限公司-不锈钢分选机-硅胶橡胶-生活垃圾-涡电流-静电-金属-矿石分选机 | 制丸机,小型中药制丸机,全自动制丸机价格-甘肃恒跃制药设备有限公司 | 重庆钣金加工厂家首页-专业定做监控电视墙_操作台 | 数控走心机-双主轴走心机厂家-南京建克| 净化工程_无尘车间_无尘车间装修-广州科凌净化工程有限公司 | 电地暖-电采暖-发热膜-石墨烯电热膜品牌加盟-暖季地暖厂家 | 数控专用机床,专用机床,自动线,组合机床,动力头,自动化加工生产线,江苏海鑫机床有限公司 | 金属检测机_金属分离器_检针验针机_食品药品金属检探测仪器-广东善安科技 | 微量水分测定仪_厂家_卡尔费休微量水分测定仪-淄博库仑 | 环压强度试验机-拉链拉力试验机-上海倾技仪器仪表科技有限公司 | 喷漆房_废气处理设备-湖北天地鑫环保设备有限公司 | 双菱电缆-广州电缆厂_广州电缆厂有限公司 | 变压器配件,变压器吸湿器,武强县吉口变压器配件有限公司 | 神马影院-实时更新秒播 | 大型低温冷却液循环泵-低温水槽冷阱「厂家品牌」京华仪器_京华仪器 | 锌合金压铸-铝合金压铸厂-压铸模具-冷挤压-誉格精密压铸 | 全自动端子机|刺破式端子压接机|全自动双头沾锡机|全自动插胶壳端子机-东莞市傅氏兄弟机械设备有限公司 | 橡胶粉碎机_橡胶磨粉机_轮胎粉碎机_轮胎磨粉机-河南鼎聚重工机械制造有限公司 | 薪动-人力资源公司-灵活用工薪资代发-费用结算-残保金优化-北京秒付科技有限公司 | 环比机械| 硬齿面减速机_厂家-山东安吉富传动设备股份有限公司 | 净化车间装修_合肥厂房无尘室设计_合肥工厂洁净工程装修公司-安徽盛世和居装饰 | 杭州中策电线|中策电缆|中策电线|杭州中策电缆|杭州中策电缆永通集团有限公司 | 办公室家具公司_办公家具品牌厂家_森拉堡办公家具【官网】 | 蒸汽热收缩机_蒸汽发生器_塑封机_包膜机_封切收缩机_热收缩包装机_真空机_全自动打包机_捆扎机_封箱机-东莞市中堡智能科技有限公司 | 丽陂特官网_手机信号屏蔽器_Wifi信号干扰器厂家_学校考场工厂会议室屏蔽仪 |