@@ -3289,11 +3289,14 @@ func HandleGetEnvironments(resp http.ResponseWriter, request *http.Request) {
32893289 // Here as well as in db-connector due to cache handling
32903290 timenow := time.Now().Unix()
32913291 for envIndex, env := range newEnvironments {
3292- if newEnvironments[envIndex].Type == "onprem" {
3293- if env.Checkin > 0 && timenow-env.Checkin > 90 {
3294- newEnvironments[envIndex].RunningIp = ""
3295- newEnvironments[envIndex].Licensed = false
3296- }
3292+ if newEnvironments[envIndex].Type != "onprem" {
3293+ continue
3294+ }
3295+
3296+ if env.Checkin > 0 && timenow-env.Checkin > 90 && len(newEnvironments[envIndex].RunningIp) > 0 {
3297+ log.Printf("[DEBUG] Resetting environment %s (%s) due to inactivity", env.Name, env.Id)
3298+ newEnvironments[envIndex].RunningIp = ""
3299+ newEnvironments[envIndex].Licensed = false
32973300 }
32983301 }
32993302
@@ -12886,6 +12889,7 @@ func GetOpenIdUrl(request *http.Request, org Org) string {
1288612889}
1288712890
1288812891func GetRequestIp(r *http.Request) string {
12892+ // Check the actual IP that is inbound
1288912893 forwardedFor := r.Header.Get("X-Forwarded-For")
1289012894 if forwardedFor != "" {
1289112895 // The X-Forwarded-For header can contain a comma-separated list of IP addresses.
@@ -12934,9 +12938,13 @@ func GetRequestIp(r *http.Request) string {
1293412938 }
1293512939 }
1293612940
12941+ // IPv6 / localhostm apping. Just returning raw.
12942+ if strings.Contains(r.RemoteAddr, "::") || strings.Contains(r.RemoteAddr, "127.0.0.1") || strings.Contains(r.RemoteAddr, "localhost") {
12943+ return r.RemoteAddr
12944+ }
12945+
1293712946 // If neither header is present, fall back to using the RemoteAddr field.
1293812947 // Check for IPv6 and split accordingly.
12939-
1294012948 re := regexp.MustCompile(`\[[^\]]+\]`)
1294112949 remoteAddr := re.ReplaceAllString(r.RemoteAddr, "")
1294212950 if remoteAddr != "" {
@@ -27839,7 +27847,7 @@ func DistributeAppToEnvironments(ctx context.Context, org Org, appnames []string
2783927847 request := ExecutionRequest{
2784027848 Type: "DOCKER_IMAGE_DOWNLOAD",
2784127849 ExecutionId: uuid.NewV4().String(),
27842- ExecutionArgument: strings.Join(appnames, ","),
27850+ ExecutionArgument: fmt.Sprintf("%s,%s", strings.ToLower(strings. Join(appnames, ",")), strings.Join(appnames, ",") ),
2784327851 Priority: 11,
2784427852 }
2784527853
0 commit comments