P
P
Petr Gavrilov2021-01-28 20:37:11
Software Deployment
Petr Gavrilov, 2021-01-28 20:37:11

How to host SPA on CDN?

There is an application on react (gatsby), a bundle of several html/css/js/json/images is assembled.
There is a droplet (virtualka) in DigitalOcean and a connected cdn in the same place.

Now: deployed in the simplest way: the static is in /var/www/mysite, nginx is up, which serves the static from this directory. In the same place, a Let's Encrypt certificate is added via certbot.

As you wish: all static files (the entire project) are uploaded to the CDN, the URL remains the same, the application works, users are happy. I googled the question, but I only find recipes for ready-made services that do all the configuration under the hood.

6012f56dd194e394081342.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly Karasik, 2021-01-28
@vitaly_il1

The easiest option is to leave everything as it is, add Cloudflare as a CDN. If you want something a little more fashionable, see https://geekflare.com/best-static-site-hosting-pla... .
UPDATE: they write that for a couple of years now you can do this with Cloudflare Workers https://www.coywolf.news/webmaster/cloudflare-stat... , I haven't tried it myself.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question