Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion apps/dashboard/src/entry-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ import startEntry from "@tanstack/react-start/server-entry";

export { SignalRelay } from "./lib/signal-relay.server";

const SECURITY_HEADERS: Record<string, string> = {
"Strict-Transport-Security": "max-age=63072000; includeSubDomains; preload",
"X-Content-Type-Options": "nosniff",
"X-Frame-Options": "DENY",
"Referrer-Policy": "strict-origin-when-cross-origin",
"Permissions-Policy": "camera=(), microphone=(), geolocation=(), payment=()",
};

async function handleWebSocketUpgrade(
request: Request,
env: Record<string, unknown>,
Expand Down Expand Up @@ -53,6 +61,16 @@ export default {
env: Record<string, unknown>,
ctx: ExecutionContext,
) => Promise<Response>;
return (startEntry.fetch as unknown as WorkerFetch)(request, env, ctx);
const response = await (startEntry.fetch as unknown as WorkerFetch)(
request,
env,
ctx,
);

for (const [key, value] of Object.entries(SECURITY_HEADERS)) {
response.headers.set(key, value);
}

return response;
},
};
Loading