From b5348db94c9a1d0751f0ce5b5e755c2b0fba7742 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Tue, 14 Aug 2012 14:48:10 +0200 Subject: [PATCH] Add CORS headers to all requests In addition to the ones served by the base Windshaft server this commit adds CORS headers to the GET /infowindow, GET /map_metadata and DEL /flush_cache requests. Closes issue #42. --- lib/cartodb/cartodb_windshaft.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/cartodb/cartodb_windshaft.js b/lib/cartodb/cartodb_windshaft.js index db23e084..cab43412 100644 --- a/lib/cartodb/cartodb_windshaft.js +++ b/lib/cartodb/cartodb_windshaft.js @@ -65,6 +65,7 @@ var CartodbWindshaft = function(serverOptions) { * Helper to allow access to the layer to be used in the maps infowindow popup. */ ws.get(serverOptions.base_url + '/infowindow', function(req, res){ + ws.doCORS(res); Step( function(){ serverOptions.getInfowindow(req, this); @@ -84,6 +85,7 @@ var CartodbWindshaft = function(serverOptions) { * Helper to allow access to metadata to be used in embedded maps. */ ws.get(serverOptions.base_url + '/map_metadata', function(req, res){ + ws.doCORS(res); Step( function(){ serverOptions.getMapMetadata(req, this); @@ -103,6 +105,7 @@ var CartodbWindshaft = function(serverOptions) { * TODO: Move? */ ws.del(serverOptions.base_url + '/flush_cache', function(req, res){ + ws.doCORS(res); Step( function(){ serverOptions.flushCache(req, Cache, this);