How to intercept XMLHttpRequest (Xhr) requests in Angular + HttpInterceptor

Balram Chavan
5 min readAug 3, 2023

The Angular provides HttpInterceptor to intercept all network requests made by Http or HttpClient service so that you can add headers like Authorization or AppId tokens. But it doesn’t intercept XmlHttpRequest (XHR) requests made explicitly. In this story, we will see how to intercept XHR requests in Angular.

Angular HttpInterceptor:

--

--