mirror of
https://github.com/Velocidex/velociraptor.git
synced 2026-10-12 02:09:59 +00:00
This PR adds a more detailed proxy configuration: 1. Allows to ignore the environment if needed. 2. Allows specifying a list of regex to apply on URLs to determine which proxy to go through (or for direct connections). 3. PAC files are now supported for configuration: - PAC files can be hosted remotely or on local file (with file:// URL) - PAC files can also be encoded in data: urls and entered directly into the config file.
16 lines
301 B
Go
16 lines
301 B
Go
package utils
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
// Retrieve the Remote Address from a request in a reverse-proxy compatible way.
|
|
func RemoteAddr(req *http.Request, header string) string {
|
|
if len(header) > 0 {
|
|
if addr := req.Header.Get(header); len(addr) > 0 {
|
|
return addr
|
|
}
|
|
}
|
|
return req.RemoteAddr
|
|
}
|