diff --git a/lib/remote/httpconnection.cpp b/lib/remote/httpconnection.cpp index 654988ca4b9..6aee8a19c03 100644 --- a/lib/remote/httpconnection.cpp +++ b/lib/remote/httpconnection.cpp @@ -149,6 +149,7 @@ void HttpConnection::ProcessMessageAsync(HttpRequest& request) if (!user) { response.SetStatus(401, "Unauthorized"); + response.AddHeader("Content-Type", "text/html"); response.AddHeader("WWW-Authenticate", "Basic realm=\"Icinga 2\""); String msg = "

Unauthorized

"; response.WriteBody(msg.CStr(), msg.GetLength()); diff --git a/lib/remote/httphandler.cpp b/lib/remote/httphandler.cpp index fde43c2b503..d785952acc5 100644 --- a/lib/remote/httphandler.cpp +++ b/lib/remote/httphandler.cpp @@ -88,6 +88,7 @@ void HttpHandler::ProcessRequest(const ApiUser::Ptr& user, HttpRequest& request, if (!handler || (!exact_match && !handler->CanAlsoHandleUrl(request.RequestUrl))) { response.SetStatus(404, "Not found"); + response.AddHeader("Content-Type", "text/html"); String msg = "

Not found

"; response.WriteBody(msg.CStr(), msg.GetLength()); response.Finish();