File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -94,18 +94,21 @@ func cloneHeaders(src http.Header) http.Header {
9494}
9595
9696func (h handler ) getCacheKey (req * http.Request ) string {
97+ hash := sha256 .New ()
98+ hash .Write ([]byte (req .Method ))
99+ hash .Write ([]byte (":" ))
100+ hash .Write ([]byte (req .URL .Path ))
101+
97102 // Check for global cache keys first
98103 for pattern , globalKey := range h .cfg .GlobalCacheKeys {
99104 if strings .HasPrefix (req .URL .Path , pattern ) {
100- return globalKey
105+ hash .Write ([]byte (":" ))
106+ hash .Write ([]byte (globalKey ))
107+
108+ return fmt .Sprintf ("%x" , hash .Sum (nil ))
101109 }
102110 }
103111
104- hash := sha256 .New ()
105- hash .Write ([]byte (req .Method ))
106- hash .Write ([]byte (":" ))
107- hash .Write ([]byte (req .URL .Path ))
108-
109112 if h .cfg .ShouldHashQuery {
110113 query := req .URL .Query ()
111114 keys := make ([]string , 0 , len (query ))
You can’t perform that action at this time.
0 commit comments