提交 b4e4d788 编写于 作者: V Vincent Latombe 提交者: Oleg Nenashev

[JENKINS-6798] Redirect on HTTP 502, 503, 504 (#4366)

* [JENKINS-6798] Redirect on HTTP >= 502 (502, 503, 504)

When Jenkins is behind a reverse proxy and is not available or
restarting, the reverse proxy will answer a HTTP 502 (because the upstream
doesn't answer).

* Add upper bound
上级 038109d2
......@@ -2778,7 +2778,7 @@ function applySafeRedirector(url) {
new Ajax.Request(url, {
method: "get",
onFailure: function(rsp) {
if(rsp.status==503 && rsp.getHeader("X-Jenkins-Interactive")==null) {
if((rsp.status >= 502 && rsp.status <= 504) && rsp.getHeader("X-Jenkins-Interactive")==null) {
// redirect as long as we are still loading
window.setTimeout(statusChecker,5000);
} else {
......
......@@ -47,7 +47,7 @@ function safeRedirector(url) {
window.setTimeout(function() {
const statusChecker = arguments.callee;
Fetch.get(url, function(error, status) {
if(status === 503 || status === 0) {
if((status >= 502 && status <= 504) || status === 0) {
window.setTimeout(statusChecker, timeout)
} else {
window.location.replace(url);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册