weixin_33743880 2017-02-17 07:20 采纳率: 0%
浏览 38

我的网域上的CORS错误[重复]

This question already has answers here:
                </div>
            </div>
                    <div class="grid--cell mb0 mt4">
                        <a href="/questions/35553500/xmlhttprequest-cannot-load-xxx-no-access-control-allow-origin-header" dir="ltr">XMLHttpRequest cannot load XXX No 'Access-Control-Allow-Origin' header</a>
                            <span class="question-originals-answer-count">
                                (8 answers)
                            </span>
                    </div>
            <div class="grid--cell mb0 mt8">Closed <span title="2017-02-17 09:06:58Z" class="relativetime">3 years ago</span>.</div>
        </div>
    </aside>

I had been developing a website and had disabled web security to bypass CORS through the following command

chrome.exe --disable-web-security --user-data-dir=/path/to/foo

After successfully developing the website, I uploaded it to my domain but got stuck with the CORS Error. I have tried adding "Access-Control-Allow-Origin": "*", but had no luck.

I can assume CORS error for localhost, but cannot understand why the error persists in my domain?

XMLHttpRequest cannot load https://xxx-xxx.xxxxx.xxxxx.xxxxx.com/. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://xxxxx.xxxxx.com' is therefore not allowed access.

</div>
  • 写回答

2条回答 默认 最新

  • weixin_33720186 2017-02-17 07:28
    关注

    To enable CORS your server has to set "Access-Control-Allow-Origin" and "Access-Control-Allow-Methods": "POST, GET, PUT, DELETE" (for example).

    For a quick reference you can check the wikipedia or for an in depth info visit de w3c specification.

    评论

报告相同问题?

悬赏问题

  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
  • ¥15 Macbookpro 连接热点正常上网,连接不了Wi-Fi。
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 linux驱动,linux应用,多线程
  • ¥20 我要一个分身加定位两个功能的安卓app
  • ¥15 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
  • ¥15 IAR程序莫名变量多重定义
  • ¥15 (标签-UDP|关键词-client)
  • ¥15 关于库卡officelite无法与虚拟机通讯的问题
  • ¥15 目标检测项目无法读取视频