mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-25 03:00:49 +00:00
Support HSTS in Clickhouse HTTP server
This commit is contained in:
parent
ec26768dce
commit
c298fba774
@ -101,7 +101,17 @@ static inline void trySendExceptionToClient(
|
|||||||
|
|
||||||
void StaticRequestHandler::handleRequest(HTTPServerRequest & request, HTTPServerResponse & response)
|
void StaticRequestHandler::handleRequest(HTTPServerRequest & request, HTTPServerResponse & response)
|
||||||
{
|
{
|
||||||
auto keep_alive_timeout = server.config().getUInt("keep_alive_timeout", 10);
|
const auto & config = server.config();
|
||||||
|
auto keep_alive_timeout = config.getUInt("keep_alive_timeout", 10);
|
||||||
|
size_t hsts_max_age = config.getUInt64("hsts_max_age", 0);
|
||||||
|
|
||||||
|
if (hsts_max_age > 0)
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << "max-age=" << hsts_max_age;
|
||||||
|
response.add("Strict-Transport-Security", ss.str());
|
||||||
|
}
|
||||||
|
|
||||||
const auto & out = responseWriteBuffer(request, response, keep_alive_timeout);
|
const auto & out = responseWriteBuffer(request, response, keep_alive_timeout);
|
||||||
|
|
||||||
try
|
try
|
||||||
|
Loading…
Reference in New Issue
Block a user