本文介绍了Https到http请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对这些协议感到困惑。在使用这些协议时可以使用哪些请求:

I am confused about these protocols. which requests are available in case of using these protocols:


  • HTTP到HTTP

  • HTTPS 到HTTP

  • HTTP到 HTTPS

  • HTTPS HTTPS

  • HTTP to HTTP
  • HTTPS to HTTP
  • HTTP to HTTPS
  • HTTPS to HTTPS

我在HTTPS中有一个域,在HTTP中有一个子域。我可以从 HTTPS 请求HTTP(POST和GET)来检索数据吗?

I have a domain in HTTPS and a sub-domain in HTTP. Can I request from HTTPS to HTTP (POST and GET ) to retrieve data?

例如:

$.getJSON('http://api.domainName.com/api/Visitor/GetStates/' + countryId, function(data) {
  $.each(data, function(key, value) {
    $("#StateId").html($("#StateId").html() +
      "<option value='" +
      value.StateId +
      "'>" +
      value.StateName +
      "</option>"
    );
  });
}

此请求来自:

我在子域中解决了CORS问题。

Whats more I solved CORS problem in sub-domain.

推荐答案

接口添加标题Access-Control-Allow-Origin:*

http://api.domainName.com/api/Visitor/GetStates/ Interface Add header "Access-Control-Allow-Origin: *"

这篇关于Https到http请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 05:53