Hosting Static Sites and SPAs on Object Storage
A static site is a website made only of files — HTML, CSS, JavaScript, images — with no server code running for each visitor. A single-page app (SPA) built with React, Vue, Angular or Svelte is one too, once it’s built. You can host one on IBEE by uploading the built files to a bucket and putting the IBEE CDN in front of it for speed, HTTPS and your own domain. There’s no server for you to run or patch.
When to use this setup
How it works
- You build the site into a folder that contains
index.html. - You upload that folder to a public bucket with the AWS CLI.
- A CDN distribution serves the bucket over HTTPS, caches files near users and, with Enable SPA, returns
index.htmlfor app routes like/dashboard. Your domain points to the CDN.
Before you begin
-
An IBEE organization with identity verification done. See Create an organization.
-
An S3 credential with Object Read & Write for the bucket, and its S3 Endpoint.
-
The AWS CLI version 2, set up with region
autoand path-style addressing: -
Your site’s build output, and access to your domain’s DNS if you’ll use your own domain.
Host the site
Create a public bucket
Create a bucket, for example my-site (bucket names can’t contain dots). Then open Settings → General and turn on Public Access. Everything in this bucket will be readable by anyone, so keep only site files in it.
Upload the build
Replace my-site, WORKSPACE-ID and ./dist with your values. --delete removes files from the bucket that no longer exist in your build:
Set cache headers on index.html
Hashed files such as assets/index-4f2a9c.js can be cached for a long time, but index.html must always be fresh so visitors get the latest version. Upload it again with no-cache, which tells browsers to check for a new copy each time:
Create a CDN distribution
Open Network & Security → CDN and click Create CDN. Choose Origin Type Object Storage Bucket, pick my-site, choose the Static Assets cache policy (1 year), and click Create Distribution. Note the CDN URL, such as dl-3f9c2a1b.cdn.ibee.ai. See CDN integration.
Turn on SPA routing (single-page apps)
On the distribution’s Overview tab, tick Enable SPA on the Single-page application (SPA) card and click Save. Routes such as /dashboard/settings then return index.html; requests for missing files still return 404. With the API: PUT /cdn/distributions/{distribution_id}/website-config (index_document, default index.html).
Add your domain
At your DNS provider, add a CNAME record from www (or another subdomain) to cname.cdn.ibee.ai. Then add www.example.com on the distribution’s page and click Verify. HTTPS is set up automatically once DNS resolves; DNS changes can take up to an hour. See CDN → Custom domains.
Verify
You should see HTTP/2 200, content-type: text/html and cache-control: no-cache. For an SPA, also open a deep link such as https://www.example.com/about directly in the browser: it should load the app, not an error.
Redeploy
Each release is a build, a sync and a fresh index.html:
Then purge /index.html on the distribution so the CDN fetches the new copy. It points to the new hashed file names, so the rest of the release loads fresh. Purge any other file you replaced under the same name, such as logo.png.
