---
title: "invalid-listen-address"
description: "Detect invalid constant HTTP listen addresses."
image: "https://strider.gempir.com/og.png"
---

> Documentation Index
> Fetch the complete documentation index at: https://strider.gempir.com/llms.txt
> Use this file to discover all available pages before exploring further.

# invalid-listen-address

**Default severity:** `error`

`http.ListenAndServe` and `http.ListenAndServeTLS` expect a host and port
separated by a colon. Either side may be omitted. Numeric ports must be in
range; service names must use their supported letter, digit, and hyphen form.

## Bad

```go
http.ListenAndServe("localhost", handler)
```

## Good

```go
http.ListenAndServe(":8080", handler)
```

Source: https://strider.gempir.com/analyzers/invalid-listen-address/index.mdx
