diff --git a/broker/JFJochBrokerHttp.cpp b/broker/JFJochBrokerHttp.cpp index 31ce0d92b..e974931fb 100644 --- a/broker/JFJochBrokerHttp.cpp +++ b/broker/JFJochBrokerHttp.cpp @@ -197,6 +197,13 @@ void JFJochBrokerHttp::attach(httplib::Server &server) { return httplib::Server::HandlerResponse::Unhandled; }); + // API answers describe the broker's state now; a browser must not keep them. Without this Firefox + // cached /statistics, and a page restored from its session adopted settings long since replaced. + server.set_post_routing_handler([](const httplib::Request &req, httplib::Response &res) { + if (req.method == "GET" && !req.path.starts_with("/frontend")) + res.set_header("Cache-Control", "no-store"); + }); + // Last resort for an exception that got past a route's own handler - httplib would otherwise // answer with a bodyless 500, which no generated client can deserialize into an error_message. server.set_exception_handler([this](const httplib::Request &, httplib::Response &res,