【问题标题】:-- No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8100' is therefore not allowed access-- 请求的资源上不存在“Access-Control-Allow-Origin”标头。因此不允许访问 Origin 'http://localhost:8100'
【发布时间】:2018-08-12 03:31:40
【问题描述】:

在尝试从提供商处访问 http:Localhost:9000/api/post 时出现此错误

Failed to load http://127.0.0.1:8000/api/post: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8100' is therefore not allowed access. is therefore not allowed access

任何人都知道出了什么问题。

【问题讨论】:

标签: javascript angular laravel ionic-framework


【解决方案1】:

您的前端和后端位于不同的端口上,这意味着您的 ajax 请求受到跨域安全性的约束。

您需要通过添加在后端 api(服务器端)进行更改

访问控制允许来源:“*”;

根据您使用的语言在响应标头中使用 php、java 或 python 等

【讨论】:

    猜你喜欢
    • 2017-09-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-26
    • 2013-12-24
    相关资源
    最近更新 更多