Files
Mike Cohen 84adea448c Added more complete proxy support. (#3320)
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.
2024-03-02 00:02:57 +10:00

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
}