[edit I should not simply say that without showing what is supposedly the better way]
no large cmdline, allow cat
while : ;do { printf 'HTTP/1.1 200 OK\n\n' ;cat index.html ; } | nc -N -l $PORT ;done
no cat, allow large cmdline
while : ;do IFS= read -d '' -r x < index.html ;printf 'HTTP/1.1 200 OK\n\n%s' "$x" | nc -N -l $PORT ;done
no cat, no large cmdline (though not strictly enforced)
while : ;do { printf 'HTTP/1.1 200 OK\n\n' ;while read -r x ;do printf '%s' "$x" ;done <index.html ; } | nc -N -l $PORT ;done
There are several versions of nc, mine uses -N to exit on eof.
From here it's only a little more to read -n 4096 to read in 4k chunks instead of in lines, since a valid html document could actually be all on one line of arbitrary unlimited length, and the final version above would be no different from the "allow large cmdline" version.