Drop cache headers from error responses.

Closes #107 (github), JIRA CDB-1423 #resolve

NOTE: does not choke on headers cleanup when response headers are not set,
      but raises a WARNING instead (JIRA CDB-1438 #resolve)
This commit is contained in:
Sandro Santilli
2014-01-14 12:51:24 +01:00
parent a660fdee12
commit 4d040801f4
3 changed files with 36 additions and 2 deletions
+14
View File
@@ -34,6 +34,20 @@ var CartodbWindshaft = function(serverOptions) {
return version;
}
// Override sendError to drop added cache headers (if any)
// See http://github.com/CartoDB/Windshaft-cartodb/issues/107
var ws_sendError = ws.sendError;
ws.sendError = function(res) {
if ( res._headers ) {
delete res._headers['cache-control'];
delete res._headers['last-modified'];
delete res._headers['x-cache-channel'];
} else {
console.log("WARNING: response has no _headers: "); console.dir(res);
}
ws_sendError.apply(this, arguments);
};
/**
* Helper to allow access to the layer to be used in the maps infowindow popup.
*/