407 Proxy Authentication Required

强颜欢笑 提交于 2019-12-21 12:19:04

问题


I'm getting the following exception while making a call using XMLHttp object asynchronously in Mozilla Firefox.

407 Proxy Authentication Required
The ISA Server requires authorization to fulfill the request.
Access to the Web Proxy filter is denied.

Description of cause:

Actually I'm trying to make an asynchronous request to using get in javascript. It is working fine using IE 6 but for IE 7 and Firefox 3.5, it will it won't get any data using asynchronous request so how to overcome this problem?

When I debug in Firefox 3.5 using firebug it shows

407 Proxy Authentication Required The ISA Server requires authorization to fulfil the request. Access to the Web Proxy filter is denied.

exception at console so how to tackle this issue

Note: our network has proxy server


回答1:


I recognize I am a little late to the party here, and this question, however, I was having the exact same problem. @FK82 indicated the right solution and I wanted to document it, as I've tried it and it works.

$.ajax({
    url: "http://somefancyurl.com/api/do_it",
    data: { id:"user" },
    dataType: "jsonp",
    success: function(data) {
        console.log(data);
    }
  });

If I do not specify jsonp I get the 407 Proxy Authentication Required error.

  • Although the original question didn't specify JQuery, I was able to test successfully with FireFox 3.6.x, and IE7 using this approach & JSONP.



回答2:


Proxy Authentication is simply an existence of a http header field called "Proxy-Authorization"

Browsers are supposed to send those stuff automatically.

But since you could add some custom header to ajax requests, you could try setting it manually.

request.setRequestHeader("Proxy-Authorization", value);
  • request is the XMLHttp object
  • value is the base64 encoded version of username:password

Note that I am not sure thats the case or not, correct me if I am wrong.

Or some page I found on google says to add X-Requested-With, may be worth to try that too.

request.setRequestHeader("X-Requested-With", "XMLHttpRequest");


来源:https://stackoverflow.com/questions/2808590/407-proxy-authentication-required

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!