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

    <tfoot id='gG3bH'></tfoot>

    • <bdo id='gG3bH'></bdo><ul id='gG3bH'></ul>

      1. <i id='gG3bH'><tr id='gG3bH'><dt id='gG3bH'><q id='gG3bH'><span id='gG3bH'><b id='gG3bH'><form id='gG3bH'><ins id='gG3bH'></ins><ul id='gG3bH'></ul><sub id='gG3bH'></sub></form><legend id='gG3bH'></legend><bdo id='gG3bH'><pre id='gG3bH'><center id='gG3bH'></center></pre></bdo></b><th id='gG3bH'></th></span></q></dt></tr></i><div id='gG3bH'><tfoot id='gG3bH'></tfoot><dl id='gG3bH'><fieldset id='gG3bH'></fieldset></dl></div>
      2. <legend id='gG3bH'><style id='gG3bH'><dir id='gG3bH'><q id='gG3bH'></q></dir></style></legend>

        AMP 访问控制允许 Source Origin 标头问题

        时间:2024-05-10

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

            <tbody id='oOfIq'></tbody>
          1. <legend id='oOfIq'><style id='oOfIq'><dir id='oOfIq'><q id='oOfIq'></q></dir></style></legend>
          2. <tfoot id='oOfIq'></tfoot>
                <bdo id='oOfIq'></bdo><ul id='oOfIq'></ul>
              • <i id='oOfIq'><tr id='oOfIq'><dt id='oOfIq'><q id='oOfIq'><span id='oOfIq'><b id='oOfIq'><form id='oOfIq'><ins id='oOfIq'></ins><ul id='oOfIq'></ul><sub id='oOfIq'></sub></form><legend id='oOfIq'></legend><bdo id='oOfIq'><pre id='oOfIq'><center id='oOfIq'></center></pre></bdo></b><th id='oOfIq'></th></span></q></dt></tr></i><div id='oOfIq'><tfoot id='oOfIq'></tfoot><dl id='oOfIq'><fieldset id='oOfIq'></fieldset></dl></div>
                • 本文介绍了AMP 访问控制允许 Source Origin 标头问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  如何解决以下错误;

                  <块引用>

                  加载资源失败:服务器响应状态为 500(内部服务器错误)cdn.ampproject.org/v0.js:68 响应必须包含 AMP-Access-Control-Allow-Source-Origin 标头码@cdn.ampproject.org/v0.js:68cdn.ampproject.org/v0.js:68 表单提交失败:错误:响应必须包含 AMP-Access-Control-Allow-Source-Origin 标头 reported

                  遵循

                  解决方案

                  请尝试以下代码

                  if(!empty($_POST)){$domain_url = (isset($_SERVER['HTTPS']) ? "https" : "http") ."://$_SERVER[HTTP_HOST]";header("内容类型:应用程序/json");header("Access-Control-Allow-Credentials: true");header("Access-Control-Allow-Origin: ".str_replace('.', '-','https://example.com') .".cdn.ampproject.org");header("AMP-Access-Control-Allow-Source-Origin: " . $domain_url);header("Access-Control-Expose-Headers: AMP-Access-Control-Allow-Source-Origin");header("AMP-Redirect-To: https://example.com/thankyou.amp.html");header("Access-Control-Expose-Headers: AMP-Redirect-To, AMP-Access-Control-Allow-Source-Origin");echo json_encode(array('successmsg'=>'data post'));出口;}

                  <块引用>

                  请确保域 url 应该是 https

                  将 https://example.com/ 替换为您想要的网址

                  How can I resolve the error below;

                  Failed to load resource: the server responded with a status of 500 (Internal Server Error) cdn.ampproject.org/v0.js:68 Response must contain the AMP-Access-Control-Allow-Source-Origin header Yd @ cdn.ampproject.org/v0.js:68 cdn.ampproject.org/v0.js:68 Form submission failed: Error: Response must contain the AMP-Access-Control-Allow-Source-Origin header reported

                  Followed all instructions at the AMP GitHub Page on CORS.

                  Below is a screenshot of my PHP code at the server side and error in the console of my browser;

                  解决方案

                  Please try with following code

                  if(!empty($_POST)){
                          $domain_url = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]";
                          header("Content-type: application/json");
                          header("Access-Control-Allow-Credentials: true");
                          header("Access-Control-Allow-Origin: ". str_replace('.', '-','https://example.com') .".cdn.ampproject.org");
                          header("AMP-Access-Control-Allow-Source-Origin: " . $domain_url);
                          header("Access-Control-Expose-Headers: AMP-Access-Control-Allow-Source-Origin");
                          header("AMP-Redirect-To: https://example.com/thankyou.amp.html");
                          header("Access-Control-Expose-Headers: AMP-Redirect-To, AMP-Access-Control-Allow-Source-Origin"); 
                          echo json_encode(array('successmsg'=>'data post'));
                          exit;
                  }
                  

                  Please make sure that domain url should be https

                  Replace https://example.com/ to your desired url

                  这篇关于AMP 访问控制允许 Source Origin 标头问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:使用 .getJSON 获取 Play 商店应用详细信息时出现跨域阻止请求 [CORS] 错误 下一篇:CORS 预检请求返回 HTTP 405

                  相关文章

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

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

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