HttpHeader

HttpHeader sets or appends a response header on the server.


Import

import { HttpHeader } from "@solidjs/start";

Type

interface HttpHeaderProps {
name: string;
value: string;
append?: boolean;
}
const HttpHeader: (props: HttpHeaderProps) => null;

Props

name

  • Type: string
  • Optional: No

Header name.

value

  • Type: string
  • Optional: No

Header value.

append

  • Type: boolean
  • Optional: Yes

Appends the value instead of setting it.


Behavior

  • A truthy append calls appendHeader(name, value); otherwise setHeader(name, value) runs.
  • Cleanup removes its own header value unless the event has completed or been handled.
  • Client rendering returns null.

Examples

Basic usage

import { HttpHeader } from "@solidjs/start";
export default function Page() {
return <HttpHeader name="cache-control" value="max-age=60" />;
}
Last updated: 7/4/26, 5:28 PMEdit this pageReport an issue with this page