Proposed in this paper is a flexible scheme of all-optical packet header extraction with SOA-based asymmetric Mach-Zehnder interferometer (SOA-MZI). The effect of cross-phase modulation (XPM) and cross-gain modulation (XGM) in SOAs coupled with the interfering characteristics of MZI are employed to make the proposal simple, fast and integrable, with no special treatment of the header pulses. In addition, the scheme, by changing parameters, is applicable to extraction of different header length and bit-rate. Through numerical analysis, an intensity contrast ratio of more than 15dB at 100Gbit/s can be achieved.