We study reaction-diffusion fronts in presence of a localized defect. We consider bistable and monostable nonlinearities for which exact solutions exist in the homogeneous case. The partial differential equation is solved numerically and the solution is fitted using these exact solutions. We also develop a collective coordinate analysis for the position and width of a front, based on balance laws. For both non linearities, the approximate analysis agrees well with the numerical solution. We cab predict the pinning of the front in the bistable case. The sudy reveals qualitative differences between the two nonlinearities. It shows the importance of the characteristic lenghts of the defect and the front. Finally it provides a reduced model, useful for control theory or for the determination of parameters from time-series.