diff --git a/httpbin/handlers.go b/httpbin/handlers.go
index 2073654f633baafd9ee65202af9fcd18151019dc..13754e6bf25949630cc6f112be8b37f3ad2e40c3 100644
--- a/httpbin/handlers.go
+++ b/httpbin/handlers.go
@@ -301,6 +301,7 @@ func (h *HTTPBin) BasicAuth(w http.ResponseWriter, r *http.Request) {
 	authorized := givenUser == expectedUser && givenPass == expectedPass
 	if !authorized {
 		status = http.StatusUnauthorized
+		w.Header().Set("WWW-Authenticate", `Basic realm="Fake Realm"`)
 	}
 
 	body, _ := json.Marshal(&authResponse{
diff --git a/httpbin/handlers_test.go b/httpbin/handlers_test.go
index 4f87bc1f754b31714c28f8fb421ce51d150d11f7..6698bcbef0bb24fd664deecd4a3f7da544e22dae 100644
--- a/httpbin/handlers_test.go
+++ b/httpbin/handlers_test.go
@@ -938,6 +938,7 @@ func TestBasicAuth(t *testing.T) {
 
 		assertStatusCode(t, w, http.StatusUnauthorized)
 		assertContentType(t, w, jsonContentType)
+		assertHeader(t, w, "WWW-Authenticate", `Basic realm="Fake Realm"`)
 
 		resp := &authResponse{}
 		json.Unmarshal(w.Body.Bytes(), resp)
@@ -959,6 +960,7 @@ func TestBasicAuth(t *testing.T) {
 
 		assertStatusCode(t, w, http.StatusUnauthorized)
 		assertContentType(t, w, jsonContentType)
+		assertHeader(t, w, "WWW-Authenticate", `Basic realm="Fake Realm"`)
 
 		resp := &authResponse{}
 		json.Unmarshal(w.Body.Bytes(), resp)