add a warning in case of transient error

This commit is contained in:
Adrien PONSIN 2025-04-17 11:48:52 +02:00
parent 32306467ea
commit 24316804d9
No known key found for this signature in database
GPG Key ID: 7B4D4A32C05C475E

View File

@ -165,7 +165,7 @@ func (ph *ProxyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
for containerName, mr = range containerMethodRegex {
resolvedIPs, err := net.LookupIP(containerName)
if err != nil {
log.Err(err).Send()
log.Warn().Err(err).Msg("this error may be transient due to the unavailability of one of the services")
}
for _, resolvedIP := range resolvedIPs {
if resolvedIP.Equal(ip) {
@ -206,33 +206,6 @@ func (s serve) action(ctx context.Context, command *cli.Command) error {
if err != nil {
return err
}
/*
requests := command.StringSlice(addRequestsFlagName)
log.Info().Msgf("%d", len(requests))
if len(requests) > 0 {
clear(containerMethodRegex)
for _, request := range requests {
// An applicator is a container name/HTTP method pair e.g., nginx(GET).
// The following regex extracts this applicator and the associated URL regex.
aur := applicatorURLRegex.FindString(request)
if aur == "" {
// If we are here, it means that user set a wildcard (kinda) applicator e.g., GET,POST:URL_REGEX.
// In its extended form, this applicator can be read as follows: *(GET,POST):URL_REGEX.
methods, urlRegex, ok := strings.Cut(request, ":")
if !ok { // || methods == ""?
return errors.New("HTTP method(s) must be specified before ':'")
}
if err = registerMethodRegex("*", urlRegex, strings.Split(methods, ",")); err != nil {
return err
}
}
applicator, urlRegex, _ := strings.Cut(aur, ":")
if err = registerMethodRegex(containerNameRegex.FindString(applicator), urlRegex, httpMethodsRegex.FindAllString(applicator, -1)); err != nil {
return err
}
}
}
*/
var l net.Listener
l, err = net.Listen("tcp", ap.srvAddrPort.String())
if err != nil {