Rearing insects for food and feed is a rapidly growing industry, because it provides excellent opportunities for a sustainable approach to animal protein production. Two fly species, the black soldier fly (BSF) and the house fly (HF), naturally live in decaying organic matter (e.g. compost), and can thus be effectively reared on organic rest streams from the food and agricultural industry. The adoption of these insects as mini-livestock on microbially rich substrates, however, requires us to address how we can safeguard insect health under mass-rearing conditions. In this review, we discuss what is known about the innate immunity of insects in general, especially focusing on a comparative approach to current knowledge for the two dipteran species BSF and HF. We also discuss environmental factors that may affect innate immunity in mass-rearing settings, including temperature, insect densities and diet composition. Furthermore, we address the role of the microbiome in insect health and the associations of these fly species with detrimental or beneficial microbes. Finally, we present a perspective on important open scientific questions for optimizing the mass rearing of these insects with respect to their health and welfare.