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
This commit is contained in:
Neil Alexander 2020-05-22 11:43:17 +01:00 committed by GitHub
parent f223da2f35
commit fe82e1f725
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 131 additions and 119 deletions

View file

@ -30,7 +30,7 @@ import (
"github.com/matrix-org/util"
)
const pathPrefixR0 = "/_matrix/client/r0"
const pathPrefixR0 = "/client/r0"
// Setup configures the given mux with sync-server listeners
//
@ -38,12 +38,12 @@ const pathPrefixR0 = "/_matrix/client/r0"
// applied:
// nolint: gocyclo
func Setup(
apiMux *mux.Router, srp *sync.RequestPool, syncDB storage.Database,
publicAPIMux *mux.Router, srp *sync.RequestPool, syncDB storage.Database,
deviceDB devices.Database, federation *gomatrixserverlib.FederationClient,
rsAPI api.RoomserverInternalAPI,
cfg *config.Dendrite,
) {
r0mux := apiMux.PathPrefix(pathPrefixR0).Subrouter()
r0mux := publicAPIMux.PathPrefix(pathPrefixR0).Subrouter()
authData := auth.Data{
AccountDB: nil,

View file

@ -81,5 +81,5 @@ func SetupSyncAPIComponent(
logrus.WithError(err).Panicf("failed to start typing server consumer")
}
routing.Setup(base.APIMux, requestPool, syncDB, deviceDB, federation, rsAPI, cfg)
routing.Setup(base.PublicAPIMux, requestPool, syncDB, deviceDB, federation, rsAPI, cfg)
}