Fix caching headers in ActivityPub endpoints (#11331)

* Fix reverse-proxy caching in public fetch mode

* Fix caching in ActivityPub-specific controllers
main
ThibG 2019-07-17 00:00:39 +02:00 committed by Eugen Rochko
parent 91544a6cb5
commit 15ddabf95a
5 changed files with 13 additions and 4 deletions

View File

@ -0,0 +1,9 @@
# frozen_string_literal: true
class ActivityPub::BaseController < Api::BaseController
private
def set_cache_headers
response.headers['Vary'] = 'Signature' if authorized_fetch_mode?
end
end

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class ActivityPub::CollectionsController < Api::BaseController
class ActivityPub::CollectionsController < ActivityPub::BaseController
include SignatureVerification
include AccountOwnedConcern

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class ActivityPub::OutboxesController < Api::BaseController
class ActivityPub::OutboxesController < ActivityPub::BaseController
LIMIT = 20
include SignatureVerification

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class ActivityPub::RepliesController < Api::BaseController
class ActivityPub::RepliesController < ActivityPub::BaseController
include SignatureAuthentication
include Authorization
include AccountOwnedConcern

View File

@ -160,6 +160,6 @@ class ApplicationController < ActionController::Base
end
def set_cache_headers
response.headers['Vary'] = 'Accept, Signature'
response.headers['Vary'] = public_fetch_mode? ? 'Accept' : 'Accept, Signature'
end
end