Mediates an immune response in larvae (PubMed:8242747). DIF binds to the kappa-B consensus sequence 5'-GGRNNYYCC-3', located in the enhancer region of the immunity gene CECA1 (PubMed:8242747). Involved in the melanization immune response to bacterial challenge, possibly by acting in a Toll signaling pathway that down-regulates Spn27A in response to infection (PubMed:12456640). Part of a signaling pathway involving NF-kappa-B (rel) and Toll-related receptors, that functions in the apoptosis of unfit cells during cell competition (PubMed:25477468). May be part of a NF-kappa-B and Tollo signaling cascade that regulates development of the peripheral nervous system (PubMed:18000549). Accumulates in the nucleus upon bacterial infection or injury.