You could also create a
fixed-layout ePub. I.e. an ePub where each page is hard-coded as a separate .xhtml file. This would give you absolute freedom about the placement of headers and footers.
However, there are several downsides: Fixed-layout ePubs are more time-consuming to create than regular ePubs, there are several different fixed-layout flavors and relatively few readers fully support them.