move some more header logic in to the 'rewrite' modules