mirror of
https://github.com/discourse/discourse.git
synced 2025-04-01 17:58:43 +08:00
FIX: Bypass AnonymousCache
for /srv/status
route. (#11491)
`/srv/status` routes should not be cached at all. Also, we want to decouple the route from Redis which `AnonymouseCache` relies on. The `/srv/status` should continue to return a success response even if Redis is down.
This commit is contained in:
parent
89bf64c0bf
commit
38b6b098bc
@ -163,6 +163,7 @@ module Middleware
|
||||
def no_cache_bypass
|
||||
request = Rack::Request.new(@env)
|
||||
request.cookies['_bypass_cache'].nil? &&
|
||||
(request.path != '/srv/status') &&
|
||||
request[Auth::DefaultCurrentUserProvider::API_KEY].nil? &&
|
||||
@env[Auth::DefaultCurrentUserProvider::USER_API_KEY].nil?
|
||||
end
|
||||
|
@ -26,6 +26,10 @@ describe Middleware::AnonymousCache do
|
||||
it "is false if it has an auth cookie" do
|
||||
expect(new_helper("HTTP_COOKIE" => "jack=1; _t=#{"1" * 32}; jill=2").cacheable?).to eq(false)
|
||||
end
|
||||
|
||||
it "is false for srv/status routes" do
|
||||
expect(new_helper("PATH_INFO" => "/srv/status").cacheable?).to eq(false)
|
||||
end
|
||||
end
|
||||
|
||||
context "per theme cache" do
|
||||
|
Loading…
x
Reference in New Issue
Block a user