Content Delivery Network (CDN)

The build files of itsa-react-server are created inside build/private and build/public, depending of their nature. You can put the build/public on the cdn. However, the web app salso needs to update its urls to the cdn. This can be done fully automaticaaly:

Setting up web app for cdn

The CDN can be setup through src/manifest.json:

{
    "cdn": {
        "enabled": true,
        "cleanupPrevious": false,
        "url": "https://s3.amazonaws.com/YOUR-PUBLIC-URL/",
        "apiVersion": "2006-03-01",
        "accessKeyId": "YOUR-ACCESS-KEY",
        "secretAccessKey": "YOUR-SECRET-KEY",
        "bucket": "YOUR-AWS-BUCKET"
    }
}

The cdn feature assumes you are using AWS S3, but you can use any other CNDN of your choice. If you choice another CDN, then keep in mind that the properties enabled, cleanupPrevious and url are needed at the least.

Deploying to the cdn

Deploying is done by:

npm run cdn

This will trigger itsa-react-server to call the file cdn-deploy, which lies in the root of your app. This file is configured for AWS S3: if you use your own CDN, then you will have to redesign this file.

Removing unused cdn files

When cdn.cleanupPrevious is set true, then the webapp will cleanup unused cdn files after the webapp itself is restarted. If you know for sure that your users are always running the latest webapp version, then you might set cdn.cleanupPrevious true. Your visitors will allways run the latest version, if you have the socketServer enabled (manifest.json).

OFFLINE