我构建了一个 React 项目只是为了尝试一些东西,我在使用SWAPI (Star Wars API)时遇到了问题。
Mixed Content Error在我的 React 项目中尝试通过 axios 使用他们的 API 时,我不断收到 。
Mixed Content: The page at 'https://zlerp.github.io/react-StarWars/#/people/2' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://swapi.dev/api/people/3/'. This request has been blocked; the content must be served over HTTPS.
即使我用 硬编码 URL https://swapi.dev/api/people/3/,我仍然收到混合内容错误。
非常感谢任何和所有帮助。
你可以在这里看到错误:https : //zlerp.github.io/react-StarWars/#/people/3
响应位置显示http可能与问题有关吗?如果是这样,我该如何改变?

我想解组具有混合内容的 XML 文件。我在 stackoverflow 上发现了一个似乎合适的线程(用于读取 @XmlValue 和 @XmlElement 的 JAXB- @XmlMixed 用法),其中用户 bdoughan 定义了 3 个用例来处理混合内容。
第三个用例将标签之间的文本保留在单个字符串变量中,并将元素保存在列表中。这就是我想要的。不幸的是,我无法让它工作,而且该线程很旧,可能已经过时了。
我已经尝试了用例#3 和对象列表以及我的参考类列表。我还尝试了@XmlElement 和@XmlValue 注释。
我在 Java SE 版本 12.0.2 的 Maven Projec 中使用版本 2.3.1 中的 javax.xml.bind jaxb-api 和版本 2.3.1 中的 org.glassfish.jaxb jaxb-runtime。
我测试过的示例 XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Date>
2018.06.27
<reference id="AnyId1">
</reference>
</Date>
Run Code Online (Sandbox Code Playgroud)
我的班级代表
@XmlRootElement(name="Date")
public class TestPojo {
@XmlMixed
public String getTextContent() {
return textContent;
}
public void setTextContent(String textContent) {
this.textContent = textContent;
}
@XmlElementRef(name="reference", type = Reference.class) …Run Code Online (Sandbox Code Playgroud) 我的 vue 组件正在 iframe 中加载外部内容
<iframe src="https://external-site" />
Run Code Online (Sandbox Code Playgroud)
在本地工作正常,但是一旦我部署到我的 https 站点
混合内容:“ https://my-site ”上的页面已通过 HTTPS 加载,但请求了不安全的框架“ http://external-site ”。此请求已被阻止;内容必须通过 HTTPS 提供。
网络选项卡显示 2 个请求,两个请求都有状态(已取消),并且请求 url 都是 HTTPS..
我正在尝试在负载均衡器后面的服务器上发布 Laravel 网站。域 SSL 托管在负载均衡器上以强制执行 HTTPS。但是,托管该网站的服务器没有 SSL。这会导致请求资产时 HTTPS 和 HTTP 不匹配。
在服务器上时,该网站可以完美运行。(localhost/CentralizedSettings/login) 在服务器外部请求时( https://blahSite.com/CentralizedSettings/login ),css 文件被涂黑,出现此错误:
错误信息:
Mixed Content: The page at 'https://blahSite.com/CentralizedSettings/login' was loaded over HTTPS,
but requested an insecure stylesheet 'http://blahSite.com/CentralizedSettings/css/app.css'.
This request has been blocked; the content must be served over HTTPS.
Run Code Online (Sandbox Code Playgroud)
head.blade.php
<link href="{{ asset('css/app.css') }}" rel="stylesheet" type="text/css" />
Run Code Online (Sandbox Code Playgroud)
.env 文件:
APP_ENV=local
APP_URL=https://blahSite.com/CentralizedSettings
Run Code Online (Sandbox Code Playgroud)
我尝试过的事情:
- Adding the APP_URL to the .env file
- Changing the url to localhost
- Using asset(mix('css/app.css'))
Run Code Online (Sandbox Code Playgroud)