Proxying using Netlify Redirects

Netlify Redirects can be used to proxy to external services.

In the below example, requests to /api are proxied to

/api/*  200

Here is an example that proxies a JS script to another location:

/js/script.js 200

Here is an example that combines the two examples above and this one is very useful for analytics tools:

/api  200
/js/script.js 200

This example is useful because it can:

  • Bypass CORS because the requests are from the same origin.
  • Bypass blockers because the URLs don't have tracker-like keywords.