chore: fix admin issue
Kim committed
Mar 17, 2026 at 18:35 UTC
197d7e04b995d21786df7d386ed4e6bb723f79f4
2 files changed
+2
-15
cmd/relay-server/admin.go
+2
-2
@@ -159,7 +159,7 @@ func (f *Frontend) serveAdmin(w http.ResponseWriter, r *http.Request) {
159
Value: "",
160
Path: types.PathAdmin,
161
HttpOnly: true,
162
- Secure: policy.IsSecureForwardedRequest(r, f.trustProxy, f.trustedCIDRs),
162
+ Secure: true,
163
SameSite: http.SameSiteStrictMode,
164
MaxAge: -1,
165
})
@@ -355,7 +355,7 @@ func (f *Frontend) handleLogin(w http.ResponseWriter, r *http.Request) {
355
Value: token,
356
Path: types.PathAdmin,
357
HttpOnly: true,
358
- Secure: policy.IsSecureForwardedRequest(r, f.trustProxy, f.trustedCIDRs),
358
+ Secure: true,
359
SameSite: http.SameSiteStrictMode,
360
MaxAge: 86400,
361
})
portal/policy/proxy_trust.go
-13
@@ -68,19 +68,6 @@ func ExtractClientIP(r *http.Request, trustProxyHeaders bool, trustedProxyCIDRs
68
return strings.TrimSpace(host)
69
}
70
71
-func IsSecureForwardedRequest(r *http.Request, trustProxyHeaders bool, trustedProxyCIDRs []*net.IPNet) bool {
72
- if r == nil {
73
- return false
74
- }
75
- if r.TLS != nil {
76
- return true
77
- }
78
- if !trustProxyHeaders || !IsTrustedProxyRemoteAddr(r.RemoteAddr, trustedProxyCIDRs) {
79
- return false
80
- }
81
- return strings.EqualFold(strings.TrimSpace(r.Header.Get("X-Forwarded-Proto")), "https")
82
-}
83
-
71
func parseRemoteAddrIP(remoteAddr string) net.IP {
72
remoteAddr = strings.TrimSpace(remoteAddr)
73
if remoteAddr == "" {