Hello. Is there anyway to bail out of a CGI application and make the server serve a static file instead? Other servers have the X-Sendfile header, but this does not seem to work. I have seen an old post in the subject, but there was no followup there: https://www.hiawatha-webserver.org/forum/topic/948
A huge use-case for this is caching CGI responses like in this example hello.cgi:
#!/bin/bash
CACHENAME=cache/hello_cached.html""
#If cache is older than 30 minutes
if [ "`find -name $CACHENAME -mmin +30`" ]; then
printf '<html>' >> $CACHENAME
printf '<head>' >> $CACHENAME
printf '<title>Hello World</title>' >> $CACHENAME
printf '</head>' >> $CACHENAME
printf '<body>' >> $CACHENAME
printf 'Hello World' >> $CACHENAME
printf '</body>' >> $CACHENAME
printf '</html>' >> $CACHENAME
fi
printf "x-sendfile: $CACHENAME\r\n\r\n"
exit 0
exit 0