Specialist and generalist pathogens may exert different costs on their hosts; thereby altering the way hosts cope with environmental variation. We examined how pathogen-challenge alters the environmental conditions that maximize host performance by simultaneously varying temperature and nutrition (protein to carbohydrate ratio; P:C) after exposure to two baculoviruses; one that is specific to the cabbage looper, Trichoplusia ni (TnSNPV) and another that has a broad host range (AcMNPV). Virus-challenged larvae performed better on more protein-biased diets, primarily due to higher survival, whereas unchallenged larvae performed best on a balanced diet. The environmental conditions that maximized host performance differed with virus identity because TnSNPV-challenge inflicted fitness costs (reduced pupal weight and prolonged development) whereas AcMNPV-challenge did not. The performance of TnSNPV-challenged larvae rose with increasing P:C across all temperatures, whereas temperature modulated the optimal P:C in AcMNPV-challenged larvae (slightly protein-biased at 16 °C to increasingly higher P:C as temperature increased). Increasing temperature reduced pupal size, but only at more balanced P:C ratios, indicating that nutrition moderates the temperature-size rule. Our findings highlight the complex environmental interactions that can alter host performance after exposure to pathogens, which could impact the role of entomopathogens as regulators of insect populations in a changing climate.