diff --git a/src/github.com/matrix-org/dendrite/cmd/client-api-proxy/main.go b/src/github.com/matrix-org/dendrite/cmd/client-api-proxy/main.go index 505026756..fb8751cad 100644 --- a/src/github.com/matrix-org/dendrite/cmd/client-api-proxy/main.go +++ b/src/github.com/matrix-org/dendrite/cmd/client-api-proxy/main.go @@ -76,7 +76,11 @@ func makeProxy(targetURL string) (*httputil.ReverseProxy, error) { "url": targetURL, "method": req.Method, }).Print("proxying request") - newURL, err := url.Parse(targetURL + path) + newURL, err := url.Parse(targetURL) + // Set the path separately as we need to preserve '#' characters + // that would otherwise be interpreted as being the start of a URL + // fragment. + newURL.Path += path if err != nil { // We already checked that we can parse the URL // So this shouldn't ever get hit.