From ed8e340fa29f6d2afea3b9d9bcd89670893425d5 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Sat, 23 Jul 2022 00:17:06 +0200 Subject: [PATCH] Add a dummy route for /.well-known/host-meta This was removed from the diaspora_federation gem, since it's not used for the federation/discovery anymore since a long time. But old versions of the ConnectionTester up to version 0.7.17 still check if this route exist or else they mark the pod as offline. So lets add a dummy host-meta with an empty response back, so the ConnectionTester is happy again until we can remove this workaround again. --- app/controllers/node_info_controller.rb | 10 ++++++++++ config/initializers/cors.rb | 1 - config/routes.rb | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/controllers/node_info_controller.rb b/app/controllers/node_info_controller.rb index cb831a595..18aa93c98 100644 --- a/app/controllers/node_info_controller.rb +++ b/app/controllers/node_info_controller.rb @@ -20,4 +20,14 @@ class NodeInfoController < ApplicationController format.all { @statistics = NodeInfoPresenter.new("1.0") } end end + + # TODO: this is only a dummy endpoint, because old versions of the ConnectionTester (<= 0.7.17.0) + # checked for this endpoint. Remove this endpoint again once most pods are updated to >= 0.7.18.0 + def host_meta + render xml: <<~XML + + + + XML + end end diff --git a/config/initializers/cors.rb b/config/initializers/cors.rb index 11a6a225b..4575c3b64 100644 --- a/config/initializers/cors.rb +++ b/config/initializers/cors.rb @@ -11,7 +11,6 @@ Rails.application.config.middleware.insert_before 0, Rack::Cors do allow do origins "*" resource "/api/*", methods: :any - resource "/.well-known/host-meta" resource "/.well-known/webfinger" resource "/.well-known/openid-configuration" end diff --git a/config/routes.rb b/config/routes.rb index f15cdd1d1..45f992209 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -213,6 +213,7 @@ Rails.application.routes.draw do get ".well-known/nodeinfo", to: "node_info#jrd" get "nodeinfo/:version", to: "node_info#document", as: "node_info", constraints: {version: /\d+\.\d+/} get "statistics", to: "node_info#statistics" + get ".well-known/host-meta", to: "node_info#host_meta" # Terms if AppConfig.settings.terms.enable? || Rails.env.test?