In mammals, cyclic GMP–AMP (cGAMP) synthase (cGAS) produces the cyclic dinucleotide 2′3′-cGAMP in response to cytosolic DNA and this triggers an antiviral immune response. cGAS belongs to a large family of cGAS/DncV-like nucleotidyltransferases that is present in both prokaryotes1 and eukaryotes2–5. In bacteria, these enzymes synthesize a range of cyclic oligonucleotides and have recently emerged as important regulators of phage infections6–8. Here we identify two cGAS-like receptors (cGLRs) in the insect Drosophila melanogaster. We show that cGLR1 and cGLR2 activate Sting- and NF-κB-dependent antiviral immunity in response to infection with RNA or DNA viruses. cGLR1 is activated by double-stranded RNA to produce the cyclic dinucleotide 3′2′-cGAMP, whereas cGLR2 produces a combination of 2′3′-cGAMP and 3′2′-cGAMP in response to an as-yet-unidentified stimulus. Our data establish cGAS as the founding member of a family of receptors that sense different types of nucleic acids and trigger immunity through the production of cyclic dinucleotides beyond 2′3′-cGAMP.