Galvanometer is a critical component for beam steering in additive manufacturing, profilometry, and medical imaging. In these applications, the quality of the process relies on the precision motion control of the galvanometer to either track or reject narrow-band signals. From the internal model principle, this can be accomplished by incorporating the dynamic model of the reference or disturbance signal in the feedback loop. This paper proposes an innovative internal model principle controller based on numerically robust all-pass filters. The main concept revolves around converting the controller design into a phase response design problem with all-pass filters. For the proposed approach, the targeted frequencies of the internal model can be arbitrarily placed without sacrificing the performance. Further, it produces lower-order controller and is robust against quantization effect. When combining with frequency estimation algorithm and adaptive filter, it can be readily applied to unknown and time-varying disturbance rejection. The advantages of the proposed method are demonstrated by comparing with conventional approaches through analysis, simulation, and experimentation.