mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-08 15:33:09 -06:00
tool: Add client-api-proxy (#73)
This commit is contained in:
parent
b9f1d53e17
commit
d1e926c2fa
|
|
@ -26,6 +26,8 @@ This tool will proxy requests for all client-server URLs and forward
|
||||||
them to their respective process. It will also add the '/api' path
|
them to their respective process. It will also add the '/api' path
|
||||||
prefix to incoming requests.
|
prefix to incoming requests.
|
||||||
|
|
||||||
|
THIS TOOL IS FOR TESTING AND NOT INTENDED FOR PRODUCTION USE.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
`
|
`
|
||||||
|
|
@ -56,8 +58,9 @@ func makeProxy(targetURL string) (*httputil.ReverseProxy, error) {
|
||||||
path := req.URL.Path
|
path := req.URL.Path
|
||||||
path = "api" + path
|
path = "api" + path
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
"path": path,
|
"path": path,
|
||||||
"url": targetURL,
|
"url": targetURL,
|
||||||
|
"method": req.Method,
|
||||||
}).Print("proxying request")
|
}).Print("proxying request")
|
||||||
newURL, err := url.Parse(targetURL + path)
|
newURL, err := url.Parse(targetURL + path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -113,7 +116,7 @@ func main() {
|
||||||
fmt.Println("Proxying requests to:")
|
fmt.Println("Proxying requests to:")
|
||||||
fmt.Println(" /_matrix/client/r0/sync => ", *syncServerURL+"/api/_matrix/client/r0/sync")
|
fmt.Println(" /_matrix/client/r0/sync => ", *syncServerURL+"/api/_matrix/client/r0/sync")
|
||||||
fmt.Println(" /* => ", *clientAPIURL+"/api/*")
|
fmt.Println(" /* => ", *clientAPIURL+"/api/*")
|
||||||
fmt.Println("Listening on %s", *bindAddress)
|
fmt.Println("Listening on ", *bindAddress)
|
||||||
srv.ListenAndServe()
|
srv.ListenAndServe()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue