about summary refs log tree commit diff
path: root/app/controllers/well_known
diff options
context:
space:
mode:
authorDavid Yip <yipdw@member.fsf.org>2017-12-30 17:20:07 -0600
committerDavid Yip <yipdw@member.fsf.org>2017-12-30 17:20:07 -0600
commit4cca1d1e7efce51eecb64489f412a7b8631f0aed (patch)
tree5259571423a25c9a478052599c5e3d04db7fc8bd /app/controllers/well_known
parente4944d065b6bd6c6718c27700971be832ed4861a (diff)
parentf4b80e6511f21b60f71ed182bb66ca6ef0ba9f66 (diff)
Merge remote-tracking branch 'origin/master' into merge-upstream
 Conflicts:
	app/controllers/auth/confirmations_controller.rb
Diffstat (limited to 'app/controllers/well_known')
-rw-r--r--app/controllers/well_known/host_meta_controller.rb6
-rw-r--r--app/controllers/well_known/webfinger_controller.rb6
2 files changed, 10 insertions, 2 deletions
diff --git a/app/controllers/well_known/host_meta_controller.rb b/app/controllers/well_known/host_meta_controller.rb
index 40f96eaa2..5fb70288a 100644
--- a/app/controllers/well_known/host_meta_controller.rb
+++ b/app/controllers/well_known/host_meta_controller.rb
@@ -1,15 +1,19 @@
 # frozen_string_literal: true
 
 module WellKnown
-  class HostMetaController < ApplicationController
+  class HostMetaController < ActionController::Base
     include RoutingHelper
 
+    before_action { response.headers['Vary'] = 'Accept' }
+
     def show
       @webfinger_template = "#{webfinger_url}?resource={uri}"
 
       respond_to do |format|
         format.xml { render content_type: 'application/xrd+xml' }
       end
+
+      expires_in(3.days, public: true)
     end
   end
 end
diff --git a/app/controllers/well_known/webfinger_controller.rb b/app/controllers/well_known/webfinger_controller.rb
index 5cc606808..28654b61d 100644
--- a/app/controllers/well_known/webfinger_controller.rb
+++ b/app/controllers/well_known/webfinger_controller.rb
@@ -1,9 +1,11 @@
 # frozen_string_literal: true
 
 module WellKnown
-  class WebfingerController < ApplicationController
+  class WebfingerController < ActionController::Base
     include RoutingHelper
 
+    before_action { response.headers['Vary'] = 'Accept' }
+
     def show
       @account = Account.find_local!(username_from_resource)
 
@@ -16,6 +18,8 @@ module WellKnown
           render content_type: 'application/xrd+xml'
         end
       end
+
+      expires_in(3.days, public: true)
     rescue ActiveRecord::RecordNotFound
       head 404
     end