Ajax调用无法从http到https? [英] Ajax call is not working from http to https?

查看:2168
本文介绍了Ajax调用无法从http到https?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的服务器中的一些文件夹被限制为使用htacess的http和https,在我的一些非https页面中,我需要调用一个使用https的ajax脚本(php)(在同一个域中),它不是工作(https到https工作正常)。

I am restricted some folders in my server to http and https using htacess, In some of my non https pages, I need to call a ajax script (php) which is using https (In the same domain), it is not working (https to https are working fine ).

我有教程/路径被重写为仅使用http,我还有一个文件夹(路径)ajax /重写为使用https,我正在从tutorials /到ajax /调用它,它失败了。

I have tutorials/ path which is rewritten to use http only, i have one more folder(path) ajax/ rewritten to use https and I am making a call from tutorials/ to ajax/, it is failing.

推荐答案

这是ajax的限制出于安全原因,您无法从http页面访问任何https页面。建议如果要使用https,则必须使用https访问网站中的所有页面。为确保这一点,您应该使用相对路径。如果您使用相关路径,则将根据您访问其他页面的源页面自动计算http或https。

It is the restriction of ajax for security reasons that you can not access any https page from http page. It is recommended that If you want to use https then all of the pages in your website must be accessed using https. To ensure this you should use relative path. If you use related path then http or https will automatically be calculated based on the source page from where you are accessing other page.

这篇关于Ajax调用无法从http到https?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆