dpbl91234 2014-05-27 22:33
浏览 631

407需要代理身份验证(Forefront TMG需要授权才能完成请求。拒绝访问Web代理筛选器。)

I have developed a website which uses Ajax POST using jQuery to a PHP server.

While it works perfectly when accessed from a web browser at home, some of my Ajax requests fail when accessed from a web browser on my day job's corporate network, and I get the following error shown by Firebug: 407 Proxy Authentication Required ( Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied. ). Note that Chrome does not show the error but it is still blocked, and IE11 blocks it as well but I haven't been able to view the message using Development Tools due to an unrelated issue (Error in jquery.validate.js in MVC 4 Project with jQuery 1.9).

I have no ability to modify anything on the corporate network, nor is it my desire to do so. My desire is to modify the HTML/JavaScript/Headers which my server provides to eliminate blocking of the request so others do not experience this issue.

What can be done?

  • 写回答

1条回答 默认 最新

  • dprh34164 2014-08-25 15:57
    关注

    This happens when you are using a complete url address in your html or jquery posts e.g.

    action="http://www.example.com/mydir/myfile.php"
    

    Try changing the url reference so that it doesn't include the website address e.g.

    action="/mydir/myfile.php"
    

    This also works when posting with AJAX/jquery e.g. the code below produces the same error

    var url1="http://www.example.com/mydir/myfile.php";
    $.post(url1, function(data){alert(data);});
    

    but this code doesn't

    var dir1="/mydir/myfile.php";
    $.post(dir1, function(data){alert(data);});
    

    It is important to note that when you switch from the complete urls to the directories, you have to define your directory relative to your current file directory.

    评论

报告相同问题?

悬赏问题

  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条