(function (angular) {
    "use strict";

    angular.module("mfl.gis.interceptor", [])

    .factory("mfl.gis.interceptor.headers", [function () {
        var etag_header = null;
        var last_modified_header = null;

        return {
            "request" : function(config) {

                if (etag_header) {
                    config.headers.ETag = etag_header;
                    config.headers["If-None-Match"] = etag_header;
                }
                if (last_modified_header) {
                    config.headers["If-Modified-Since"] = last_modified_header;
                }
                return config;
            },

            "response": function(response) {
                var etag = response.headers("ETag");
                var last_modified = response.headers("Last-Modified");
                if (etag) {
                    etag_header = etag;
                }
                if (last_modified) {
                    last_modified_header = last_modified;
                }
                return response;
            }
        };
    }]);

})(angular);

@@ -156,27 +156,28 @@
 var 
-etag
+cache
 _header
+s
  = 
-null;
+%7B%7D;%0A
 %0A   
@@ -189,119 +189,316 @@
 var 
-last_modified_
+request_fxn = function(config) %7B%0A            var 
 header
+s
  = 
-null;%0A%0A        return %7B%0A            %22request%22 : function(config) %7B%0A%0A                if (
+cache_headers%5Bconfig.url%5D;%0A            if (_.isUndefined(headers)) %7B%0A                console.log(%22cache miss : %22, config.url);%0A                return config;%0A            %7D%0A            console.log(%22cache hit : %22, config.url);%0A            if (headers.
 etag
@@ -500,36 +500,32 @@
 .etag_header) %7B%0A
-    
                 
@@ -546,16 +546,24 @@
 .ETag = 
+headers.
 etag_hea
@@ -575,36 +575,32 @@
                 
-    
 config.headers%5B%22
@@ -617,16 +617,24 @@
 tch%22%5D = 
+headers.
 etag_hea
@@ -646,32 +646,26 @@
             
-    %7D%0A  
+%7D%0A
             
@@ -656,38 +656,44 @@
   %7D%0A            
-  
 if (
+headers.
 last_modified_he
@@ -692,36 +692,32 @@
 ified_header) %7B%0A
-    
                 
@@ -754,16 +754,24 @@
 nce%22%5D = 
+headers.
 last_mod
@@ -776,36 +776,32 @@
 odified_header;%0A
-    
             %7D%0A  
@@ -802,36 +802,32 @@
   %7D%0A            
-    
 return config;%0A 
@@ -837,14 +837,10 @@
     
-    %7D,
+%7D;
 %0A%0A  
@@ -849,21 +849,20 @@
     
-    %22
+var 
 response
 %22: f
@@ -861,10 +861,14 @@
 onse
-%22:
+_fxn =
  fun
@@ -893,28 +893,24 @@
             
- 
-   
 var etag = r
@@ -930,28 +930,24 @@
 rs(%22ETag%22);%0A
-    
             
@@ -997,32 +997,58 @@
 Modified%22);%0A    
+        var headers = %7B%7D;%0A
             if (
@@ -1071,20 +1071,24 @@
         
-  
-  
+headers.
 etag_hea
@@ -1107,34 +1107,26 @@
             
-    %7D%0A    
+%7D%0A
             
@@ -1162,20 +1162,24 @@
         
-    
+headers.
 last_mod
@@ -1212,36 +1212,32 @@
 ed;%0A            
-    
 %7D%0A              
@@ -1238,42 +1238,185 @@
     
-    return response;%0A            %7D
+cache_headers%5Bresponse.config.url%5D = headers;%0A            return response;%0A        %7D;%0A%0A        return %7B%0A            %22request%22 : request_fxn,%0A            %22response%22: response_fxn
 %0A   

Make cache headers sentitive to urls