久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <small id='dDPHW'></small><noframes id='dDPHW'>

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

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

          <bdo id='dDPHW'></bdo><ul id='dDPHW'></ul>
        <tfoot id='dDPHW'></tfoot>

        對需要身份驗證的云運行服務(wù)的 Ajax 請求

        Ajax request to cloud run service that requires authentication(對需要身份驗證的云運行服務(wù)的 Ajax 請求)
        <legend id='xQNM5'><style id='xQNM5'><dir id='xQNM5'><q id='xQNM5'></q></dir></style></legend>
        <i id='xQNM5'><tr id='xQNM5'><dt id='xQNM5'><q id='xQNM5'><span id='xQNM5'><b id='xQNM5'><form id='xQNM5'><ins id='xQNM5'></ins><ul id='xQNM5'></ul><sub id='xQNM5'></sub></form><legend id='xQNM5'></legend><bdo id='xQNM5'><pre id='xQNM5'><center id='xQNM5'></center></pre></bdo></b><th id='xQNM5'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='xQNM5'><tfoot id='xQNM5'></tfoot><dl id='xQNM5'><fieldset id='xQNM5'></fieldset></dl></div>
            <tbody id='xQNM5'></tbody>

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

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

                • 本文介紹了對需要身份驗證的云運行服務(wù)的 Ajax 請求的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我遇到了與谷歌云有關(guān)的 CORS 相關(guān)問題,該服務(wù)運行在
                  需要身份驗證.

                  I'm having a CORS related issue with google cloud run on a service that
                  requires authentication.

                  如果我嘗試通過 cli 使用 Bearer 令牌執(zhí)行 curl 命令,
                  一切正常.不幸的是,如果我嘗試在 javascript 中通過 ajax 執(zhí)行相同的調(diào)用,
                  我收到了 403.

                  If I try to execute a curl command through the cli, with a Bearer token,
                  everything works fine. Unfortunately if I try to execute the same call through ajax in javascript,
                  I receive a 403.

                    const http = new XMLHttpRequest();
                    const url = 'https://my-app.run.app';
                  
                    http.open("GET", url);
                    http.withCredentials = true;
                    http.setRequestHeader("authorization", 'Bearer ' + id_token);
                    http.send();
                    http.onreadystatechange = (e) => {
                      console.log(http.responseText)
                    }
                  

                  云運行日志中的錯誤是這樣的:

                  The error in the cloud run logs is this :

                  The request was not authenticated. Either allow unauthenticated invocations or set the proper Authorization header. Read more at https://cloud.google.com/run/docs/securing/authenticating
                  

                  容器永遠(yuǎn)不會被擊中.

                  我看到的問題是,當(dāng)我在網(wǎng)絡(luò)中使用 ajax 進行調(diào)用時
                  瀏覽器.網(wǎng)絡(luò)瀏覽器正在發(fā)出飛行前請求(
                  url )而不發(fā)送授權(quán)標(biāo)頭(這是預(yù)期的
                  行為)

                  The issue I'm seeing is that, as I'm making the call using ajax, in a web
                  browser. The web browser is making a pre flight request ( OPTIONS on the
                  url ) without sending the Authorization header ( which is an expected
                  behavior )

                  問題似乎是云運行嘗試驗證 OPTIONS
                  請求并且永遠(yuǎn)不會到達(dá)我的容器,據(jù)我所知,
                  不應(yīng)該這樣做.(
                  https://www.w3.org/TR/cors/#cross-origin-request-with-preflight-0 )

                  The problem seems to be that cloud run tries to authenticate the OPTIONS
                  request and never makes it to my container, which, as far as I understand,
                  shouldn't be done. (
                  https://www.w3.org/TR/cors/#cross-origin-request-with-preflight-0 )

                  這是云運行的已知問題嗎?

                  Is that a known issue with cloud run ?

                  如何向經(jīng)過身份驗證的云運行服務(wù)發(fā)出 ajax 請求?

                  How could I make an ajax request to an authenticated cloud run service ?

                  推薦答案

                  (Cloud Run PM)

                  (Cloud Run PM)

                  這是一個已知問題.有幾個選項:

                  This is a known issue. There are a few options:

                  1. 允許未經(jīng)身份驗證的請求并自行執(zhí)行 CORS/身份驗證
                  1. Allow unauthenticated requests and do CORS/auth yourself
                  1. 使用 Cloud Endpoints 在Cloud Run 在您的計算機前運行.讓 Endpoints 對您的最終用戶進行身份驗證,然后將請求轉(zhuǎn)發(fā)到您的后端.
                  1. There is a variation of this that uses Cloud Endpoints running on Cloud Run in front of your compute. Have Endpoints do your end-user auth, then forward the request to your backend.

                • 從同一域提供服務(wù)(例如,使用 Firebase 托管代理)
                • 我們已經(jīng)考慮實施 Istio CORSPolicy,它將在身份驗證檢查之前返回 CORS 標(biāo)頭,盡管我們目前還沒有承諾.

                  We've considered implementing Istio CORSPolicy, which would return CORS headers before the auth check, though we're not committed to this as of now.

                  這篇關(guān)于對需要身份驗證的云運行服務(wù)的 Ajax 請求的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  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 部分內(nèi)容)
                  XmlHttpRequest onprogress interval(XmlHttpRequest onprogress 間隔)
                  How can I modify the XMLHttpRequest responsetext received by another function?(如何修改另一個函數(shù)接收到的 XMLHttpRequest 響應(yīng)文本?)
                  What is the difference between XMLHttpRequest, jQuery.ajax, jQuery.post, jQuery.get(XMLHttpRequest、jQuery.ajax、jQuery.post、jQuery.get 有什么區(qū)別)
                  <i id='TBOFb'><tr id='TBOFb'><dt id='TBOFb'><q id='TBOFb'><span id='TBOFb'><b id='TBOFb'><form id='TBOFb'><ins id='TBOFb'></ins><ul id='TBOFb'></ul><sub id='TBOFb'></sub></form><legend id='TBOFb'></legend><bdo id='TBOFb'><pre id='TBOFb'><center id='TBOFb'></center></pre></bdo></b><th id='TBOFb'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='TBOFb'><tfoot id='TBOFb'></tfoot><dl id='TBOFb'><fieldset id='TBOFb'></fieldset></dl></div>

                      <tbody id='TBOFb'></tbody>
                    <tfoot id='TBOFb'></tfoot>

                  • <legend id='TBOFb'><style id='TBOFb'><dir id='TBOFb'><q id='TBOFb'></q></dir></style></legend>

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

                          <bdo id='TBOFb'></bdo><ul id='TBOFb'></ul>
                            主站蜘蛛池模板: 天堂国产| 操操日 | 亚洲国产精品美女 | 亚洲精品视频免费 | 一级毛片视频 | 91精品综合久久久久久五月天 | 99精品亚洲国产精品久久不卡 | 欧美国产91 | 亚洲国产aⅴ成人精品无吗 欧美激情欧美激情在线五月 | 天天天天天天操 | 99色综合| 国产一区二区三区高清 | 日韩精品一区二区三区视频播放 | 九九天堂网| 色射综合| 亚洲高清视频在线观看 | 日韩免费福利视频 | 中文字幕日本一区二区 | 日韩免费av | 亚洲网址 | 色屁屁在线观看 | 一区二区三区视频免费观看 | 一级aaaaaa毛片免费同男同女 | 日韩久久精品 | 免费黄色片在线观看 | 中文字幕第一页在线 | 欧美一级视频免费看 | 玖玖玖在线 | 中文字幕日韩一区 | 欧美亚洲国产一区二区三区 | 国产伦精品一区二区三区四区视频 | 欧美精品欧美精品系列 | 精品久久精品 | 国产精品免费一区二区三区四区 | 男人的天堂在线视频 | 大久| av男人的天堂av | 国产视频h | 中文字幕一区在线观看视频 | 91精品国产综合久久精品 | 亚州精品天堂中文字幕 |