【发布时间】:2017-11-02 23:46:45
【问题描述】:
我正在尝试对我的报告进行 AJAX 化处理,以绕过 CloudFlare 对通过其站点运行的请求施加的 100 秒超时。
见Is it possible to increase CloudFlare time-out?
我做了以下事情:
function ajaxReport() {
var seconds = prompt("Please enter how many seconds you want the report to run", "5");
$('#imgWaiting').show();
$.post("post/post_ajaxReport.jsp",
{
theParam:seconds
},function(data) {
$('#imgWaiting').hide();
window.location=data;
});
}
以及 post_ajaxReport.jsp 的以下内容
<%
int theParam=myFunctionToConvertStringToInt(request.getParameter("theParam"));
int a=theParam/60;
int b=theParam-a*60;
String query="WAITFOR DELAY '00:"+a+":"+b+"';";
double d=myCustomCodeToRunQuery(query);
String fileName=createReport();
%>
<%=fileName%>
代码在 100 秒内运行良好。但没有工作超过 100 秒。
有什么想法吗?
反馈后更新
我的报告现在可以在没有 AJAX 的情况下正常工作(尽管 CloudFlare 有 100 秒的超时)。我试图将它们转换为 AJAX 以避免对子域产生灰色影响,因为我不想公开我的 IP 地址。如果我要对子域进行灰云化,我会在原始代码上进行,这比 AJAX 化我的代码要简单得多!我的问题是“如何修复我的 AJAX 代码,这样我就可以避免 100 秒超时,但又不会暴露我的 IP 地址……”
【问题讨论】:
标签: javascript ajax asynchronous timeout cloudflare