Skip to main content

Hosted Webapps

RestAPI.com hosts your static websites and single-page applications (SPAs) with automatic SSL and CDN distribution.

Hosting Your App​

Subdomain Hosting​

Your app is accessible at:

https://<api-name>.restapi.cloud

Example:

https://my-app.restapi.cloud

Custom Domains​

Use your own domain with managed SSL certificates:

https://www.my-domain.com

Configure custom domains in the Developer Portal under your API's Web App Settings.

Multiple Hostnames​

You can specify multiple custom hostnames by separating them with commas:

www.my-domain.com, app.my-domain.com, my-other-domain.com

This is useful when you want to serve the same application from multiple domains or subdomains.

Supported Frameworks​

Any static site or SPA works, including:

  • React
  • Angular
  • Vue
  • Svelte
  • Static HTML/CSS/JS

Web App Configuration​

Configure your hosted app under Web App Settings in the Developer Portal:

SettingDescription
Default DocumentFile served for root and directory requests (e.g., index.html)
Error DocumentCustom page shown for 404 errors
Use Default on 404Serve the default document instead of 404 — required for SPAs with client-side routing
Cache Max AgeBrowser cache duration in seconds

File Resolution​

When a request comes in, the server resolves files in this order:

  1. Exact path match (e.g., /about.html)
  2. Path with .html extension (e.g., /about → /about.html)
  3. Path as directory with default document (e.g., /about → /about/index.html)
  4. Default document (if Use Default on 404 is enabled)
tip

For SPAs (React, Angular, Vue, etc.), set your Default Document to index.html and enable Use Default on 404. This ensures client-side routing works correctly.

Deployment Options​

Developer Portal​

Upload your build files directly through the portal's File Explorer. You can upload individual files or ZIP archives that are automatically extracted.

Command Line and CI/CD Pipelines​

Deploy with the RestAPI Terminal from your machine or a pipeline (GitHub Actions, Azure DevOps):

rat api -a my-api deploy

It uploads your build folder (dist/ by default) with POST /System/Tenant/{tenantId}/Api/{apiId}/Webapp/Upload, which you can also call directly (multipart field file; extractZip=true unpacks a ZIP).

Publishing and Plans​

Uploading the web files publishes the app, and publishing can change its plan. On the Trial and Team plans, publishing an app that is on the Free plan moves it to Starter, which is on the monthly invoice. If the organisation has no invoice details yet, the upload is refused and nothing is uploaded. Paid apps, apps created before November 2026 and Business organisations publish without moving. The full rule is in Plans and Limits.

Check first. To find out what publishing will take without uploading anything:

GET /System/Tenant/{tenantId}/Api/{apiId}/Webapp/PublishCheck

outcome is allowed, movesToStarter, needsInvoiceDetails or refused, with message, planName, monthlyPrice, currency, missingInvoiceDetails and canEditInvoiceDetails. See Checking before you publish for an example.

What the upload answers:

AnswerMeaning
200 with header X-Plan-Changed: StarterUploaded, and the app moved to the plan named in the header. rat prints a note.
403, errorNumber 99019Nothing uploaded: the organisation needs invoice details first. The body is the same as PublishCheck's. Add the fields in missingInvoiceDetails with PUT /System/Tenant/{tenantId}, then upload again.
403, errorNumber 99018Nothing uploaded: Softeria turned off publishing on the Free plan for this Business organisation. Move the app to a paid plan.
400, errorNumber 99012Nothing uploaded: the plan the app would move to has no price for the organisation's currency. Contact Softeria.

A pipeline should treat 403 as final, not retry it, and should report errorMessage as it is.

Virtual Paths​

Hosted apps access APIs through virtual paths, eliminating CORS configuration:

PathDescription
/<region>-apiRegion-specific, CORS-free
/apiRegion-free, CORS-free
/loginHosted authentication page

Examples​

Instead of calling the full URL:

fetch("https://<region>.restapi.com/<api-name>/products");

Use the virtual path:

fetch("/api/products");

No CORS headers needed. The request is handled internally.

Full URL Examples​

https://my-app.restapi.cloud/eu-api/my-api/products
https://www.my-domain.com/api/my-api/products
note

The region-free /api path may have slightly higher latency than region-specific paths like /eu-api.

CORS Configuration​

If you need to access your API from external domains (not your hosted app), configure CORS in the Developer Portal:

  1. Navigate to Security → CORS
  2. Add allowed origins

For hosted apps using virtual paths, CORS configuration is not required.

To restrict access by client IP address (rather than browser origin), configure Security → IP Whitelist — see IP Allowlist. The IP allowlist applies to both the API endpoints and the hosted app.

Authentication​

Use the hosted login page at /login for user authentication:

https://my-app.restapi.cloud/login

This provides a ready-to-use authentication UI with your configured identity providers.

Hosted webapps use cookie-based authentication. After a user logs in, the server sets secure cookies:

  • Authorization cookie — contains the access token (HttpOnly, Secure, SameSite=Lax)
  • Refresh cookie — used to obtain new access tokens

Tokens are automatically refreshed via the /api/_refresh endpoint. To log out a user, send a POST request to /api/_logout — this invalidates the current session and clears both cookies.

App Configuration Endpoint​

Your frontend can query /api/_webAppConfig to retrieve the webapp's authentication configuration (e.g., which login providers are enabled).