You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
606 B
25 lines
606 B
import { getRequestURL } from "h3";
|
|
import { isCloudProbePath } from "#server/constants/cloud-probes";
|
|
|
|
const METHODS = new Set(["GET", "HEAD"]);
|
|
|
|
export default eventHandler((event) => {
|
|
if (!METHODS.has(event.method)) return;
|
|
|
|
const pathname = getRequestURL(event).pathname;
|
|
if (!isCloudProbePath(pathname)) return;
|
|
|
|
setHeader(event, "content-type", "text/plain; charset=utf-8");
|
|
setHeader(
|
|
event,
|
|
"cache-control",
|
|
"no-store, no-cache, must-revalidate, proxy-revalidate",
|
|
);
|
|
|
|
if (event.method === "HEAD") {
|
|
setResponseStatus(event, 200);
|
|
return;
|
|
}
|
|
|
|
return "OK";
|
|
});
|
|
|