aboutsummaryrefslogtreecommitdiff
path: root/federationapi
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2020-05-22 11:43:17 +0100
committerGitHub <noreply@github.com>2020-05-22 11:43:17 +0100
commitfe82e1f7255c05e0bc7a7872a53cf2a1a78ffaa0 (patch)
tree84661722411a9098f1925d2a5192e4c40d0a1122 /federationapi
parentf223da2f35e690e80c6e3d8c1050f0984ab33a2f (diff)
Separate muxes for public and internal APIs (#1056)
* Separate muxes for public and internal APIs * Update client-api-proxy and federation-api-proxy so they don't add /api to the path * Tidy up * Consistent HTTP setup * Set up prefixes properly
Diffstat (limited to 'federationapi')
-rw-r--r--federationapi/federationapi.go2
-rw-r--r--federationapi/routing/routing.go14
2 files changed, 8 insertions, 8 deletions
diff --git a/federationapi/federationapi.go b/federationapi/federationapi.go
index 9e341140..baeaa36b 100644
--- a/federationapi/federationapi.go
+++ b/federationapi/federationapi.go
@@ -44,7 +44,7 @@ func SetupFederationAPIComponent(
roomserverProducer := producers.NewRoomserverProducer(rsAPI)
routing.Setup(
- base.APIMux, base.Cfg, rsAPI, asAPI, roomserverProducer,
+ base.PublicAPIMux, base.Cfg, rsAPI, asAPI, roomserverProducer,
eduProducer, federationSenderAPI, *keyRing,
federation, accountsDB, deviceDB,
)
diff --git a/federationapi/routing/routing.go b/federationapi/routing/routing.go
index c368c16c..86d3192a 100644
--- a/federationapi/routing/routing.go
+++ b/federationapi/routing/routing.go
@@ -31,9 +31,9 @@ import (
)
const (
- pathPrefixV2Keys = "/_matrix/key/v2"
- pathPrefixV1Federation = "/_matrix/federation/v1"
- pathPrefixV2Federation = "/_matrix/federation/v2"
+ pathPrefixV2Keys = "/key/v2"
+ pathPrefixV1Federation = "/federation/v1"
+ pathPrefixV2Federation = "/federation/v2"
)
// Setup registers HTTP handlers with the given ServeMux.
@@ -42,7 +42,7 @@ const (
// applied:
// nolint: gocyclo
func Setup(
- apiMux *mux.Router,
+ publicAPIMux *mux.Router,
cfg *config.Dendrite,
rsAPI roomserverAPI.RoomserverInternalAPI,
asAPI appserviceAPI.AppServiceQueryAPI,
@@ -54,9 +54,9 @@ func Setup(
accountDB accounts.Database,
deviceDB devices.Database,
) {
- v2keysmux := apiMux.PathPrefix(pathPrefixV2Keys).Subrouter()
- v1fedmux := apiMux.PathPrefix(pathPrefixV1Federation).Subrouter()
- v2fedmux := apiMux.PathPrefix(pathPrefixV2Federation).Subrouter()
+ v2keysmux := publicAPIMux.PathPrefix(pathPrefixV2Keys).Subrouter()
+ v1fedmux := publicAPIMux.PathPrefix(pathPrefixV1Federation).Subrouter()
+ v2fedmux := publicAPIMux.PathPrefix(pathPrefixV2Federation).Subrouter()
localKeys := internal.MakeExternalAPI("localkeys", func(req *http.Request) util.JSONResponse {
return LocalKeys(cfg)