fix(oidc): update login handler to set redirect header for frontend requests

This commit is contained in:
yusing
2025-05-29 20:08:52 +08:00
parent ed07bf42ce
commit 24ba4c2a46
2 changed files with 17 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
package auth
import (
"net"
"net/http"
"time"
@@ -16,7 +17,15 @@ var (
)
func IsFrontend(r *http.Request) bool {
return r.Host == common.APIHTTPAddr
return requestRemoteIP(r) == "127.0.0.1"
}
func requestRemoteIP(r *http.Request) string {
ip, _, err := net.SplitHostPort(r.RemoteAddr)
if err != nil {
return ""
}
return ip
}
func requestHost(r *http.Request) string {