Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2018-04-17 13:50:27 +0300
committerSean McGivern <sean@gitlab.com>2018-04-17 13:50:27 +0300
commitd77db0adbd8198b5b3611bd3fb53bed960ed0035 (patch)
treea13c96056621a0e62ee82fd64ab63679b756c106 /lib/gitlab/etag_caching
parenta18363e48e1c62a0319d3cdff3caebbd65a8ddcb (diff)
Fix flash errors in performance bar for cached responses
When a request contains an ETag value in its If-None-Match header, the backend may send a request ID (from Rack) that does not correspond to a value in Peek's Redis cache (because we aborted the Rails processing in our ETag middleware). Because a cached response (304) has to replace the headers with those from the previous 200 - https://tools.ietf.org/html/rfc7234#section-4.3.4 - we add a custom header that will only be present in cache hits, that can tell the frontend to ignore these.
Diffstat (limited to 'lib/gitlab/etag_caching')
-rw-r--r--lib/gitlab/etag_caching/middleware.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/gitlab/etag_caching/middleware.rb b/lib/gitlab/etag_caching/middleware.rb
index 1d6f5bb5e1c..d5d35dbd97f 100644
--- a/lib/gitlab/etag_caching/middleware.rb
+++ b/lib/gitlab/etag_caching/middleware.rb
@@ -50,7 +50,7 @@ module Gitlab
status_code = Gitlab::PollingInterval.polling_enabled? ? 304 : 429
- [status_code, { 'ETag' => etag }, []]
+ [status_code, { 'ETag' => etag, 'X-Gitlab-From-Cache' => 'true' }, []]
end
def track_cache_miss(if_none_match, cached_value_present, route)