Local structural frustration, the existence of mutually exclusive competing interactions, may explain why some proteins are dynamic while others are rigid. Frustration is thought to underpin biomolecular recognition and the flexibility of protein-binding sites. Here, we show how a small chemical modification, the oxidation of two cysteine thiols to a disulfide bond, during the catalytic cycle of the N-terminal domain of the key bacterial oxidoreductase DsbD (nDsbD), introduces frustration ultimately influencing protein function. In oxidized nDsbD, local frustration disrupts the packing of the protective cap-loop region against the active site allowing loop opening. By contrast, in reduced nDsbD the cap loop is rigid, always protecting the active-site thiols from the oxidizing environment of the periplasm. Our results point toward an intricate coupling between the dynamics of the active-site cysteines and of the cap loop which modulates the association reactions of nDsbD with its partners resulting in optimized protein function.