The addHeader method allows to pass the type as an argument ('default', 'even', 'first') which is great.
Unfortunately, when defining a different header for odd and even pages, you also need to set <w:evenAndOddHeaders/> in the settings.xml (this corresponds to the "Different Odd & Even Pages" option in word. Because this is not done, the headers are not correctly generated.