Browse Source

downstream caches shouldn't cache server errors, fixes #136

jomo 9 years ago
parent
commit
6a5967dfba
1 changed files with 3 additions and 1 deletions
  1. 3 1
      lib/response.js

+ 3 - 1
lib/response.js

@@ -4,7 +4,7 @@ var crc = require("crc").crc32;
 
 var human_status = {
   "-2": "user error",   // e.g. invalid size
-  "-1": "server error", // e.g. network issues
+  "-1": "server error", // e.g. mojang/network issues
   0: "none",            // cached as null (user has no skin)
   1: "cached",          // found on disk
   2: "downloaded",      // profile downloaded, skin downloaded from mojang servers
@@ -85,6 +85,8 @@ module.exports = function(request, response, result) {
   if (result.status === -2) {
     response.writeHead(result.code || 422, headers);
   } else if (result.status === -1) {
+    // 500 responses shouldn't be cached
+    headers["Cache-Control"] = "private, max-age=0, no-cache";
     response.writeHead(500, headers);
   } else {
     if (result.body) {