Skip to content

Commit

Permalink
Merge branch 'feat/add_prometheus_metrics' into refactoring/dynamic_vars
Browse files Browse the repository at this point in the history
  • Loading branch information
nsarrazin committed May 3, 2024
2 parents 9e00109 + 75b2833 commit 3ade054
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/hooks.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,12 @@ export const handleError: HandleServerError = async ({ error, event }) => {
};

export const handle: Handle = async ({ event, resolve }) => {
// only allow metrics from localhost if we're not in dev mode
if (
event.url.pathname.startsWith(`${base}/metrics`) &&
!dev &&
event.request.headers.get("host") !== "localhost:3000"
) {
return new Response("Forbidden", { status: 403 });
}
logger.info({
locals: event.locals,
url: event.url.pathname,
params: event.params,
request: event.request,
});

if (event.url.pathname.startsWith(`${base}/api/`) && env.EXPOSE_API !== "true") {
return new Response("API is disabled", { status: 403 });
Expand Down

0 comments on commit 3ade054

Please sign in to comment.