aboutsummaryrefslogtreecommitdiff
path: root/clientapi/routing
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 /clientapi/routing
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 'clientapi/routing')
-rw-r--r--clientapi/routing/routing.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/clientapi/routing/routing.go b/clientapi/routing/routing.go
index 377881cb..934d9f06 100644
--- a/clientapi/routing/routing.go
+++ b/clientapi/routing/routing.go
@@ -36,9 +36,9 @@ import (
"github.com/matrix-org/util"
)
-const pathPrefixV1 = "/_matrix/client/api/v1"
-const pathPrefixR0 = "/_matrix/client/r0"
-const pathPrefixUnstable = "/_matrix/client/unstable"
+const pathPrefixV1 = "/client/api/v1"
+const pathPrefixR0 = "/client/r0"
+const pathPrefixUnstable = "/client/unstable"
// Setup registers HTTP handlers with the given ServeMux. It also supplies the given http.Client
// to clients which need to make outbound HTTP requests.
@@ -47,7 +47,7 @@ const pathPrefixUnstable = "/_matrix/client/unstable"
// applied:
// nolint: gocyclo
func Setup(
- apiMux *mux.Router, cfg *config.Dendrite,
+ publicAPIMux *mux.Router, cfg *config.Dendrite,
producer *producers.RoomserverProducer,
rsAPI roomserverAPI.RoomserverInternalAPI,
asAPI appserviceAPI.AppServiceQueryAPI,
@@ -62,7 +62,7 @@ func Setup(
federationSender federationSenderAPI.FederationSenderInternalAPI,
) {
- apiMux.Handle("/_matrix/client/versions",
+ publicAPIMux.Handle("/client/versions",
internal.MakeExternalAPI("versions", func(req *http.Request) util.JSONResponse {
return util.JSONResponse{
Code: http.StatusOK,
@@ -78,9 +78,9 @@ func Setup(
}),
).Methods(http.MethodGet, http.MethodOptions)
- r0mux := apiMux.PathPrefix(pathPrefixR0).Subrouter()
- v1mux := apiMux.PathPrefix(pathPrefixV1).Subrouter()
- unstableMux := apiMux.PathPrefix(pathPrefixUnstable).Subrouter()
+ r0mux := publicAPIMux.PathPrefix(pathPrefixR0).Subrouter()
+ v1mux := publicAPIMux.PathPrefix(pathPrefixV1).Subrouter()
+ unstableMux := publicAPIMux.PathPrefix(pathPrefixUnstable).Subrouter()
authData := auth.Data{
AccountDB: accountDB,