0
0
Fork 0

Fix caching logic with regards to Accept-Language, Cookie, and Signature (#24604)

This commit is contained in:
Claire 2023-04-23 22:27:24 +02:00 committed by GitHub
parent 5dc3173ef8
commit 58a1b2e330
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 62 additions and 45 deletions

View file

@ -12,7 +12,6 @@ class Api::BaseController < ApplicationController
before_action :require_authenticated_user!, if: :disallow_unauthenticated_api_access?
before_action :require_not_suspended!
before_action :set_cache_control_defaults
protect_from_forgery with: :null_session
@ -148,10 +147,6 @@ class Api::BaseController < ApplicationController
doorkeeper_authorize!(*scopes) if doorkeeper_token
end
def set_cache_control_defaults
response.cache_control.replace(private: true, no_store: true)
end
def disallow_unauthenticated_api_access?
ENV['DISALLOW_UNAUTHENTICATED_API_ACCESS'] == 'true' || Rails.configuration.x.whitelist_mode
end