change nginx for handling mesh seerver refractor
All checks were successful
CI / build-test (push) Successful in 49s
Deploy Staging (Docker) / deploy (push) Successful in 39s

This commit is contained in:
bachhungcb 2026-05-13 16:44:32 +07:00
parent 8d40607738
commit fae5908213
2 changed files with 4 additions and 12 deletions

View File

@ -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;

View File

@ -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) => {