diff --git a/nginx/nginx.conf b/nginx/nginx.conf index a732e78..a4d32bd 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -154,11 +154,8 @@ server { return 301 /api/meshcentral/proxy/; } - location ^~ /api/meshcentral/proxy/ { - # Forward directly to MeshCentral, but strip proxy prefix first. - # Without this, upstream sees /api/meshcentral/proxy/* and can redirect-loop. - rewrite ^/api/meshcentral/proxy/(.*)$ /$1 break; - proxy_pass http://$meshserver; + location ~ ^/api/meshcentral/proxy/(.*)$ { + proxy_pass http://$meshserver/$1$is_args$args; proxy_cookie_path / "/; HTTPOnly; Secure; SameSite=None"; proxy_set_header Host $meshhost; diff --git a/src/routes/_auth/remote-control/index.tsx b/src/routes/_auth/remote-control/index.tsx index a8ed770..9ff7a6c 100644 --- a/src/routes/_auth/remote-control/index.tsx +++ b/src/routes/_auth/remote-control/index.tsx @@ -35,13 +35,8 @@ function RemoteControlPage() { onSuccess: (data) => { setErrorMessage(null); - // Chuyển URL MeshCentral thành proxy URL - const originalUrl = new URL(data.url); - const pathAndQuery = originalUrl.pathname + originalUrl.search; - const proxyUrlFull = buildMeshProxyUrl(pathAndQuery); - - console.log("[RemoteControl] Proxy URL:", proxyUrlFull); - setProxyUrl(proxyUrlFull); + console.log("[RemoteControl] URL:", data.url); + setProxyUrl(data.url); setShowRemote(true); }, onError: (error: any) => {