Last active
August 9, 2016 12:09
-
-
Save OmeGak/f9b21627128220fc0531859ea16ca019 to your computer and use it in GitHub Desktop.
NGINX 502 autoreload
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<head> | |
<title>502 Bad Gateway</title> | |
</head> | |
<body> | |
<body bgcolor="white"> | |
<center><h1>502 Bad Gateway</h1></center> | |
<hr><center>nginx</center> | |
<script> | |
function tryRefresh() { | |
var xhr = new XMLHttpRequest(); | |
xhr.open('GET', location.href); | |
xhr.send(null); | |
xhr.onreadystatechange = function() { | |
var DONE = 4; | |
if (xhr.readyState === DONE) { | |
if (xhr.status != 502) { | |
location.reload(true); | |
} else { | |
setTimeout(tryRefresh, 1000); | |
} | |
} | |
}; | |
} | |
tryRefresh(); | |
</script> | |
</body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http { | |
# ... | |
server { | |
# ... | |
error_page 502 /502.html; | |
location = /502.html { | |
alias /home/omegak/.dotfiles/indico/502.html; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment