mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-14 10:54:27 +00:00
868568d1c1
* Make host_meta/webfinger replies cacheable (fixes #6100) Drop common code for handling users and sessions as webfinger queries are very basic, public APIs. Also explicitly mark results as cacheable with “expires_in”. * Add “Vary: Accept” header for caching since content-negociation is used
20 lines
425 B
Ruby
20 lines
425 B
Ruby
# frozen_string_literal: true
|
|
|
|
module WellKnown
|
|
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
|