mirror of
https://github.com/azures04/crafatar.git
synced 2026-03-21 23:41:18 +01:00
use 500 instead of 502 when using Cloudflare
Otherwise Cloudflare will replace images served with 502 with their own error page. This can only be turned off in paid plans of Cloudflare.
This commit is contained in:
parent
7ad6f85aec
commit
22448c098b
@ -95,7 +95,13 @@ module.exports = function(request, response, result) {
|
||||
if (result.err && result.err.code === "ENOENT") {
|
||||
result.code = result.code || 500;
|
||||
}
|
||||
response.writeHead(result.code || 502, headers);
|
||||
if (!result.code) {
|
||||
// Don't use 502 on Cloudflare
|
||||
// As they will show their own error page instead
|
||||
// https://support.cloudflare.com/hc/en-us/articles/200172706
|
||||
result.code = config.caching.cloudflare ? 500 : 502;
|
||||
}
|
||||
response.writeHead(result.code, headers);
|
||||
} else {
|
||||
if (result.body) {
|
||||
if (result.status === 4) {
|
||||
|
||||
@ -227,7 +227,12 @@
|
||||
<section id="meta-http-headers">
|
||||
<h3><a href="#meta-http-headers">HTTP Headers</a></h3>
|
||||
<p>
|
||||
Crafatar always replies with a <code>200 OK</code> status code when the requested user's skin/cape was found. This is also used in some rare cases when Mojang servers are having issues and the image couldn't be checked for changes, but Crafatar still had a cached version. <code>502 Bad Gateway</code> and <code>500 Server Error</code> are used when no skin/cape was found because of Mojang or Crafatar server issues.
|
||||
Crafatar always replies with a <code>200 OK</code> status code when the requested user's skin/cape was found. This is also used in some rare cases when Mojang servers are having issues and the image couldn't be checked for changes, but Crafatar still had a cached version.
|
||||
<% if (config.caching.cloudflare) { %>
|
||||
<code>500 Server Error</code> is used when no skin/cape was found because of Mojang or Crafatar server issues.
|
||||
<% } else { %>
|
||||
<code>502 Bad Gateway</code> and <code>500 Server Error</code> are used when no skin/cape was found because of Mojang or Crafatar server issues.
|
||||
<% } %>
|
||||
</p>
|
||||
<p>
|
||||
Note that requests are usually answered with an image (with Steve/Alex skin), even if an error occured!
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user