mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2025-08-19 08:27:37 +00:00
add helpful error message to 403 response
Signed-off-by: Jared Van Bortel <jared@nomic.ai>
This commit is contained in:
parent
86326bb57b
commit
f6a6dcf750
@ -501,7 +501,10 @@ void Server::start()
|
||||
// this works for HTTP/1.1 "Host" header and HTTP/2 ":authority" pseudo-header
|
||||
auto host = req.url().host();
|
||||
if (!host.isEmpty() && isHostUnsafe(host))
|
||||
return QHttpServerResponse(QHttpServerResponder::StatusCode::Forbidden);
|
||||
return QHttpServerResponse(
|
||||
QJsonObject { { u"error"_s, u"Access to the server via non-local host %1 is forbidden."_s.arg(host) } },
|
||||
QHttpServerResponder::StatusCode::Forbidden
|
||||
);
|
||||
return std::nullopt;
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user