简体   繁体   English

即使使用apache代理,$。ajax在跨域请求中也会失败

[英]$.ajax fails in Cross-domain request even with apache proxy

I am suppose to reach the URL below and to verify that i am getting HTTP status 200 or something else. 我想到达下面的URL,并验证我的HTTP状态为200或其他。 http://AAAAAAAAAA.com:59060/eddUtilityService/eddUtilityService.wsdl http://AAAAAAAAAA.com:59060/eddUtilityService/eddUtilityService.wsdl

As none of the existing questions on cross-domain is not answering my issue. 由于跨网域上的现有问题都无法回答我的问题。 So please don't ignore this. 因此,请不要忽略这一点。

This is the ajax call I am making from my HTML file. 这是我从HTML文件进行的ajax调用。

$.ajax({
    url: "/l2/eddUtilityService/eddUtilityService.wsdl",        
    type: "HEAD",
    async: false,
    contentType: "JSONP",
    success: function(data){
        console.log("SUCCESS for ajax call ");
        return data.responseCode;
    },
    error:function(jqXHR, textStatus, errorThrown){
        console.log("Error for ajax call "+jqXHR.status+"-- "+textStatus+"--"+errorThrown);
        return jqXHR.status;
    }

However i have my proxy setup in Apache is as below; 但是我在Apache中设置了代理,如下所示;

            RewriteRule /l2/eddUtilityService/eddUtilityService.wsdl http://AAAAAAAAAA.com:59060/eddUtilityService/eddUtilityService.wsdl
            ProxyPassReverse /l2/ http://AAAAAAAAAA.com:59060/

But i am getting the error as result and jqXHR.status is 0 and also its readyStatus is equal to 0. 但是我得到的结果是错误,jqXHR.status为0,并且readyStatus等于0。

Could somebody say what's wrond in the above code? 有人可以说上面代码中的错误吗? I have also tried with contentType="text/xml" and "application/text" just json. 我也尝试过contentType =“ text / xml”和“ application / text”只是json。 But results are same. 但是结果是一样的。

I don't know much about apache proxy so I'm not sure if this will be of much help but the HTTP response headers from the server should have this header: "Access-Control-Allow-Origin", "*" to allow the cross-origin request. 我对apache代理了解不多,所以我不确定这是否有很大帮助,但是服务器的HTTP响应标头应具有以下标头:“ Access-Control-Allow-Origin”,“ *”以允许跨域请求。 You might want to check the configuration of your proxy 您可能要检查代理的配置

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

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