File tree Expand file tree Collapse file tree 1 file changed +5
-20
lines changed
Expand file tree Collapse file tree 1 file changed +5
-20
lines changed Original file line number Diff line number Diff line change 1- // learn more: https://fly.io/docs/reference/configuration/#services-http_checks
2- import type { LoaderFunction } from "react-router" ;
3-
4- export const loader : LoaderFunction = async ( { request } ) => {
5- const host =
6- request . headers . get ( "X-Forwarded-Host" ) ?? request . headers . get ( "host" ) ;
7-
8- try {
9- const url = new URL ( "/" , `http://${ host } ` ) ;
10- await Promise . all ( [
11- fetch ( url . toString ( ) , { method : "HEAD" } ) . then ( ( r ) => {
12- if ( ! r . ok ) return Promise . reject ( r ) ;
13- } ) ,
14- ] ) ;
15- return new Response ( "OK" ) ;
16- } catch ( error : unknown ) {
17- console . log ( "healthcheck ❌" , { error } ) ;
18- return new Response ( "ERROR" , { status : 500 } ) ;
19- }
20- } ;
1+ export async function loader ( ) {
2+ return new Response ( "OK" , {
3+ headers : { "Cache-Control" : "no-store" } ,
4+ } ) ;
5+ }
You can’t perform that action at this time.
0 commit comments