diff --git a/lib/response.js b/lib/response.js index 7f63d99..da6e95b 100644 --- a/lib/response.js +++ b/lib/response.js @@ -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) { diff --git a/lib/views/index.html.ejs b/lib/views/index.html.ejs index 4439fcb..b43dd93 100644 --- a/lib/views/index.html.ejs +++ b/lib/views/index.html.ejs @@ -227,7 +227,12 @@

HTTP Headers

- Crafatar always replies with a 200 OK 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. 502 Bad Gateway and 500 Server Error are used when no skin/cape was found because of Mojang or Crafatar server issues. + Crafatar always replies with a 200 OK 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) { %> + 500 Server Error is used when no skin/cape was found because of Mojang or Crafatar server issues. + <% } else { %> + 502 Bad Gateway and 500 Server Error are used when no skin/cape was found because of Mojang or Crafatar server issues. + <% } %>

Note that requests are usually answered with an image (with Steve/Alex skin), even if an error occured!