fix: X-Real-IP condition

This commit is contained in:
minoplhy 2024-04-11 21:15:21 +07:00
parent 14e819e09b
commit b5dfbf5395
Signed by: minoplhy
GPG Key ID: 41D406044E2434BF

View File

@ -90,8 +90,8 @@ func uploadHandler(w http.ResponseWriter, r *http.Request) {
"Content-Type": "application/json",
}
if handler.IsInternalIP(r.RemoteAddr) {
UploadHeaders["X-Real-IP"] = r.RemoteAddr
if r.Header.Get("X-Real-IP") != "" && handler.IsInternalIP(r.RemoteAddr) {
UploadHeaders["X-Real-IP"] = r.Header.Get("X-Real-IP")
}
chibisafe_post, err := handler.UploadPost(Chibisafe_basepath, UploadHeaders, PostData)
@ -134,8 +134,8 @@ func uploadHandler(w http.ResponseWriter, r *http.Request) {
"Content-Type": "application/json",
}
if handler.IsInternalIP(r.RemoteAddr) {
ProcessHeaders["X-Real-IP"] = r.RemoteAddr
if r.Header.Get("X-Real-IP") != "" && handler.IsInternalIP(r.RemoteAddr) {
ProcessHeaders["X-Real-IP"] = r.Header.Get("X-Real-IP")
}
PostProcess, err := handler.UploadProcessPost(Chibisafe_basepath, ProcessHeaders, PostProcessData)