diff --git a/cmd/server/main.go b/cmd/server/main.go index 8a598f2..a4500a6 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -1,9 +1,6 @@ package main import ( - "bytes" - "compress/flate" - "encoding/base64" "encoding/json" "fmt" "html/template" @@ -342,18 +339,9 @@ func buildDiagramsNetURL(r *http.Request, id string, xml string) string { scheme = "https" } base := fmt.Sprintf("%s://%s/diagram?id=%s", scheme, r.Host, url.QueryEscape(id)) - // For self-hosted instances that insist on proxying, avoid the remote fetch entirely by providing a compressed data - // URI in the fragment. Fragment data is not sent over the network, so this stays client-side and avoids proxy 404s. - target := base - if xml != "" { - var buf bytes.Buffer - w, _ := flate.NewWriter(&buf, flate.BestCompression) - _, _ = w.Write([]byte(xml)) - _ = w.Close() - compressed := base64.StdEncoding.EncodeToString(buf.Bytes()) - target = "data:application/octet-stream;base64," + compressed - } - return fmt.Sprintf("%s/?splash=0&ui=min&libs=aws4#U%s", drawioBaseURL, target) + encoded := url.QueryEscape(base) + // Ask draw.io not to proxy (`proxy=0`) so it fetches directly (CORS headers are already set on /diagram). + return fmt.Sprintf("%s/?splash=0&ui=min&libs=aws4&proxy=0&url=%s", drawioBaseURL, encoded) } func addCORS(w http.ResponseWriter) {