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/; return 301 /api/meshcentral/proxy/;
} }
location ^~ /api/meshcentral/proxy/ { location ~ ^/api/meshcentral/proxy/(.*)$ {
# Forward directly to MeshCentral, but strip proxy prefix first. proxy_pass http://$meshserver/$1$is_args$args;
# Without this, upstream sees /api/meshcentral/proxy/* and can redirect-loop.
rewrite ^/api/meshcentral/proxy/(.*)$ /$1 break;
proxy_pass http://$meshserver;
proxy_cookie_path / "/; HTTPOnly; Secure; SameSite=None"; proxy_cookie_path / "/; HTTPOnly; Secure; SameSite=None";
proxy_set_header Host $meshhost; proxy_set_header Host $meshhost;

View File

@ -35,13 +35,8 @@ function RemoteControlPage() {
onSuccess: (data) => { onSuccess: (data) => {
setErrorMessage(null); setErrorMessage(null);
// Chuyển URL MeshCentral thành proxy URL console.log("[RemoteControl] URL:", data.url);
const originalUrl = new URL(data.url); setProxyUrl(data.url);
const pathAndQuery = originalUrl.pathname + originalUrl.search;
const proxyUrlFull = buildMeshProxyUrl(pathAndQuery);
console.log("[RemoteControl] Proxy URL:", proxyUrlFull);
setProxyUrl(proxyUrlFull);
setShowRemote(true); setShowRemote(true);
}, },
onError: (error: any) => { onError: (error: any) => {