From 9186e02083629d03685f5ca347bd9e8054f5392a Mon Sep 17 00:00:00 2001 From: cclohmar Date: Wed, 14 Oct 2026 14:21:35 +0000 Subject: [PATCH] fix: use /plugin/ prefix for Zoraxy plugin API endpoints (declared + called) --- main.go | 8 ++++---- server.go | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 6699800..2a153ac 100644 --- a/main.go +++ b/main.go @@ -27,10 +27,10 @@ func main() { UIPath: "/ui", PermittedAPIEndpoints: []zoraxy_plugin.PermittedAPIEndpoint{ - {Method: "GET", Endpoint: "/api/proxy/list", Reason: "List proxy rules and their tags"}, - {Method: "GET", Endpoint: "/api/proxy/header/list", Reason: "Read existing custom headers on a domain"}, - {Method: "POST", Endpoint: "/api/proxy/header/add", Reason: "Copy headers onto tagged domains"}, - {Method: "POST", Endpoint: "/api/proxy/header/remove", Reason: "Remove copied headers from tagged domains"}, + {Method: "GET", Endpoint: "/plugin/api/proxy/list", Reason: "List proxy rules and their tags"}, + {Method: "GET", Endpoint: "/plugin/api/proxy/header/list", Reason: "Read existing custom headers on a domain"}, + {Method: "POST", Endpoint: "/plugin/api/proxy/header/add", Reason: "Copy headers onto tagged domains"}, + {Method: "POST", Endpoint: "/plugin/api/proxy/header/remove", Reason: "Remove copied headers from tagged domains"}, }, } diff --git a/server.go b/server.go index bdf21dd..1fcd14b 100644 --- a/server.go +++ b/server.go @@ -27,6 +27,10 @@ func (c *ZoraxyClient) do(method, path string, form url.Values) ([]byte, error) if form != nil { body = strings.NewReader(form.Encode()) } + // Zoraxy plugin API endpoints are mounted under /plugin/. + if !strings.HasPrefix(path, "/plugin/") { + path = "/plugin" + path + } req, err := http.NewRequest(method, c.BaseURL+path, body) if err != nil { return nil, err