change nginx for handling mesh seerver refractor
This commit is contained in:
parent
8d40607738
commit
fae5908213
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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) => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user