Using Netlify redirects as a reverse proxy

Created by Donald Ng, Modified on Wed, 21 Aug at 8:17 AM by Donald Ng

Netlify supports redirects and rewrites which we can use as a reverse proxy from an /mida route. In your netlify.toml file, add a redirect like this:

[[redirects]]
from = "/mida/*"
to = "https://cdn.mida.so/:splat"
host = "cdn.mida.so"
status = 200
force = true


Once done, set the /mida route of your domain as the md_cdn in your Mida.so initialization like this:

<script>
window.md_cdn = 'https://www.your-domain.com/mida'
</script>
<script src="https://www.your-domain.com/mida/js/optimize.js?key=XXXXXX" />


Once updated, deploy your changes on Netlify and check that Mida.so requests are going to https://www.your-domain.com/mida by checking the network tab on your domain.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article