write Content-Length header for index