繁体   English   中英

如何在使用https的网站中通过http发送post请求?

[英]how to send a post request through http in website that uses https?

我正在创建一个 chrome 扩展,它需要通过普通的 http 向服务器发送发布请求,但这会导致混合内容错误,并且当我在用户 Https 的网站中时,浏览器不处理请求。

错误信息:

混合内容:“https://www.google.com/”上的页面已通过 HTTPS 加载,但请求了不安全的 XMLHttpRequest 端点“http://example.se:8080/v1/check”。 此请求已被阻止; 内容必须通过 HTTPS 提供。

    var settings = {
  "url": "http://example.se:8080/v1/check",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "postman-token": "e7705111-e7d7-0284-e4cd-56115243e076",
    "Content-Type": "application/json"
  },
  "data": JSON.stringify({"langCode":"pt-rr","text":"Por favor, leia as regrs. Meu nom é Nicolas. bowré o qunto maor pabn dks do."}),
};

$.ajax(settings).done(function (response) {
  console.log(response);
});

不推荐使用mix-content ,你应该使用HTTPS

但是如果您想出于开发目的绕过它,您可以在站点设置中允许它。

请参阅此问题如何让 Chrome 允许混合内容?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM