mirror of
https://github.com/minoplhy/chibisafe-netproxy.git
synced 2024-12-22 10:08:08 +00:00
add: comment on X-Real-IP
This commit is contained in:
parent
2650a8c31f
commit
53c6992ef6
2
main.go
2
main.go
@ -90,6 +90,7 @@ func uploadHandler(w http.ResponseWriter, r *http.Request) {
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
|
||||
// Check if client sent X-Real-IP Header
|
||||
if r.Header.Get("X-Real-IP") != "" && handler.IsInternalIP(r.RemoteAddr) {
|
||||
UploadHeaders["X-Real-IP"] = r.Header.Get("X-Real-IP")
|
||||
}
|
||||
@ -134,6 +135,7 @@ func uploadHandler(w http.ResponseWriter, r *http.Request) {
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
|
||||
// Check if client sent X-Real-IP Header
|
||||
if r.Header.Get("X-Real-IP") != "" && handler.IsInternalIP(r.RemoteAddr) {
|
||||
ProcessHeaders["X-Real-IP"] = r.Header.Get("X-Real-IP")
|
||||
}
|
||||
|
@ -5,8 +5,8 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Check if request IP Address is in internal ranges
|
||||
func IsInternalIP(ip string) bool {
|
||||
|
||||
parts := strings.Split(ip, ":")
|
||||
ip = parts[0]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user