Refactor Cache-Control
and Vary
definitions (#24347)
This commit is contained in:
parent
4db8230194
commit
e98c86050a
64 changed files with 424 additions and 173 deletions
|
@ -12,7 +12,7 @@ class Api::BaseController < ApplicationController
|
|||
|
||||
before_action :require_authenticated_user!, if: :disallow_unauthenticated_api_access?
|
||||
before_action :require_not_suspended!
|
||||
before_action :set_cache_headers
|
||||
before_action :set_cache_control_defaults
|
||||
|
||||
protect_from_forgery with: :null_session
|
||||
|
||||
|
@ -148,8 +148,8 @@ class Api::BaseController < ApplicationController
|
|||
doorkeeper_authorize!(*scopes) if doorkeeper_token
|
||||
end
|
||||
|
||||
def set_cache_headers
|
||||
response.headers['Cache-Control'] = 'private, no-store'
|
||||
def set_cache_control_defaults
|
||||
response.cache_control.replace(private: true, no_store: true)
|
||||
end
|
||||
|
||||
def disallow_unauthenticated_api_access?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue