Filters and interceptors
Filters and interceptors are registered as providers. Filters are typically used for modifying the message headers. To understand filters, let's look at a practical use case. Cross-origin requests are requests that are made from one domain to another. It's not alien to have your web resources hosted on one domain while the requests may originate from another. For security reasons, browsers restrict such requests, which are made within scripts. The solution is Cross-Origin Resource Sharing (CORS); this mechanism allows servers to publish the set of origins that are allowed for making web browser requests to it. This is done by adding the Access-Control headers to the response, and to do that we would need to define ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access