Search code examples
cdncloudflarenetlify

How to enable CDN for a subdomain with external web server?


My landing page is a static built website on Netlify. Then I have a subdomain, which is an A record in DNS (set in Netlify). This subdomain is points to an external web server (nginx+Django), which provides REST API and serves static content. The question is how can I make this subdomain to use Netlify's CDN, when serving static content from Django API? Are there any approaches to do it?

Netlify advises against using any CDN in front of it, as it already provides CDN. As well as there'll be a problem with SSL certificate.

I tried my best to look for such a question, but I couldn’t pick the right terms, I suppose, so I didn’t find it.

I would be very grateful for any advice!

Thank you and best regards!


Solution

  • You can use Netlify's Proxy Rewrites: https://docs.netlify.com/routing/redirects/rewrites-proxies/ to add some level of CDN to your site. However, it will totally be upto Netlify to decide how much time your content will stay in cache. If it's not in Netlify's cache, there won't be much of a performance boost by doing this - so I'd advise against it, unless absolutely necessary.