mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-04 22:40:24 +00:00
fix(gateway): add HSTS header hardening and docs
This commit is contained in:
@@ -417,6 +417,7 @@ export function createGatewayHttpServer(opts: {
|
||||
openAiChatCompletionsEnabled: boolean;
|
||||
openResponsesEnabled: boolean;
|
||||
openResponsesConfig?: import("../config/types.gateway.js").GatewayHttpResponsesConfig;
|
||||
strictTransportSecurityHeader?: string;
|
||||
handleHooksRequest: HooksRequestHandler;
|
||||
handlePluginRequest?: HooksRequestHandler;
|
||||
resolvedAuth: ResolvedGatewayAuth;
|
||||
@@ -433,6 +434,7 @@ export function createGatewayHttpServer(opts: {
|
||||
openAiChatCompletionsEnabled,
|
||||
openResponsesEnabled,
|
||||
openResponsesConfig,
|
||||
strictTransportSecurityHeader,
|
||||
handleHooksRequest,
|
||||
handlePluginRequest,
|
||||
resolvedAuth,
|
||||
@@ -447,7 +449,9 @@ export function createGatewayHttpServer(opts: {
|
||||
});
|
||||
|
||||
async function handleRequest(req: IncomingMessage, res: ServerResponse) {
|
||||
setDefaultSecurityHeaders(res);
|
||||
setDefaultSecurityHeaders(res, {
|
||||
strictTransportSecurity: strictTransportSecurityHeader,
|
||||
});
|
||||
|
||||
// Don't interfere with WebSocket upgrades; ws handles the 'upgrade' event.
|
||||
if (String(req.headers.upgrade ?? "").toLowerCase() === "websocket") {
|
||||
|
||||
Reference in New Issue
Block a user