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:
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user