mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-18 16:26:38 +00:00
remove query parameters on refresh
This commit is contained in:
2
proxy/web/dist/assets/index.js
vendored
2
proxy/web/dist/assets/index.js
vendored
File diff suppressed because one or more lines are too long
@@ -7,7 +7,7 @@ import { PoweredByNetBird } from "@/components/PoweredByNetBird";
|
|||||||
import { StatusCard } from "@/components/StatusCard";
|
import { StatusCard } from "@/components/StatusCard";
|
||||||
import type { ErrorData } from "@/data";
|
import type { ErrorData } from "@/data";
|
||||||
|
|
||||||
export function ErrorPage({ code, title, message, proxy = true, destination = true, requestId, simple = false }: ErrorData) {
|
export function ErrorPage({ code, title, message, proxy = true, destination = true, requestId, simple = false, retryUrl }: ErrorData) {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
document.title = `${title} - NetBird Service`;
|
document.title = `${title} - NetBird Service`;
|
||||||
}, [title]);
|
}, [title]);
|
||||||
@@ -38,7 +38,7 @@ export function ErrorPage({ code, title, message, proxy = true, destination = tr
|
|||||||
|
|
||||||
{/* Buttons */}
|
{/* Buttons */}
|
||||||
<div className="flex gap-3 justify-center items-center mb-6 z-10 relative">
|
<div className="flex gap-3 justify-center items-center mb-6 z-10 relative">
|
||||||
<Button variant="primary" onClick={() => window.location.reload()}>
|
<Button variant="primary" onClick={() => retryUrl ? window.location.href = retryUrl : window.location.reload()}>
|
||||||
<RotateCw size={16} />
|
<RotateCw size={16} />
|
||||||
Refresh Page
|
Refresh Page
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ export interface ErrorData {
|
|||||||
destination?: boolean
|
destination?: boolean
|
||||||
requestId?: string
|
requestId?: string
|
||||||
simple?: boolean
|
simple?: boolean
|
||||||
|
retryUrl?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Data injected by Go templates
|
// Data injected by Go templates
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
"html/template"
|
"html/template"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
@@ -171,6 +172,18 @@ func ServeAccessDeniedPage(w http.ResponseWriter, r *http.Request, code int, tit
|
|||||||
"message": message,
|
"message": message,
|
||||||
"requestId": requestID,
|
"requestId": requestID,
|
||||||
"simple": true,
|
"simple": true,
|
||||||
|
"retryUrl": stripAuthParams(r.URL),
|
||||||
},
|
},
|
||||||
}, code)
|
}, code)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// stripAuthParams returns the request URI with auth-related query parameters removed.
|
||||||
|
func stripAuthParams(u *url.URL) string {
|
||||||
|
q := u.Query()
|
||||||
|
q.Del("session_token")
|
||||||
|
q.Del("error")
|
||||||
|
q.Del("error_description")
|
||||||
|
clean := *u
|
||||||
|
clean.RawQuery = q.Encode()
|
||||||
|
return clean.RequestURI()
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user