Ver código fonte

Fix caching headers in ActivityPub endpoints (#11331)

* Fix reverse-proxy caching in public fetch mode

* Fix caching in ActivityPub-specific controllers
master^2
ThibG 4 anos atrás
committed by Eugen Rochko
pai
commit
15ddabf95a
5 arquivos alterados com 13 adições e 4 exclusões
  1. +9
    -0
      app/controllers/activitypub/base_controller.rb
  2. +1
    -1
      app/controllers/activitypub/collections_controller.rb
  3. +1
    -1
      app/controllers/activitypub/outboxes_controller.rb
  4. +1
    -1
      app/controllers/activitypub/replies_controller.rb
  5. +1
    -1
      app/controllers/application_controller.rb

+ 9
- 0
app/controllers/activitypub/base_controller.rb Ver arquivo

@@ -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

+ 1
- 1
app/controllers/activitypub/collections_controller.rb Ver arquivo

@@ -1,6 +1,6 @@
# frozen_string_literal: true

class ActivityPub::CollectionsController < Api::BaseController
class ActivityPub::CollectionsController < ActivityPub::BaseController
include SignatureVerification
include AccountOwnedConcern



+ 1
- 1
app/controllers/activitypub/outboxes_controller.rb Ver arquivo

@@ -1,6 +1,6 @@
# frozen_string_literal: true

class ActivityPub::OutboxesController < Api::BaseController
class ActivityPub::OutboxesController < ActivityPub::BaseController
LIMIT = 20

include SignatureVerification


+ 1
- 1
app/controllers/activitypub/replies_controller.rb Ver arquivo

@@ -1,6 +1,6 @@
# frozen_string_literal: true

class ActivityPub::RepliesController < Api::BaseController
class ActivityPub::RepliesController < ActivityPub::BaseController
include SignatureAuthentication
include Authorization
include AccountOwnedConcern


+ 1
- 1
app/controllers/application_controller.rb Ver arquivo

@@ -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

Carregando…
Cancelar
Salvar