mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
FIX: anonymous cache could cache json for html requests
This commit is contained in:
parent
f9ae7472b4
commit
8646c21e89
1 changed files with 6 additions and 1 deletions
|
@ -44,8 +44,13 @@ module Middleware
|
||||||
@is_crawler == :true
|
@is_crawler == :true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def accept_html?
|
||||||
|
accept = @env["HTTP_ACCEPT"]
|
||||||
|
!!(accept && accept =~ /html/)
|
||||||
|
end
|
||||||
|
|
||||||
def cache_key
|
def cache_key
|
||||||
@cache_key ||= "ANON_CACHE_#{@env["HTTP_HOST"]}#{@env["REQUEST_URI"]}|m=#{is_mobile?}|c=#{is_crawler?}"
|
@cache_key ||= "ANON_CACHE_#{accept_html?}_#{@env["HTTP_HOST"]}#{@env["REQUEST_URI"]}|m=#{is_mobile?}|c=#{is_crawler?}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def cache_key_body
|
def cache_key_body
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue