Hosted Web apps
Web app hosting
Hosted web apps are accessed using a service-provided sub-hostname under the domain restapi.cloud or using a custom domain.
The name of the api is used as a sub-hostname. For an API named "my-app", the web app hostname would be: https://my-app.restapi.cloud
SSL certificate and DNS are managed by the service provider.
Web app hosting supports any SPA or static website, like React, Angular or Vue. The web app bundle can be uploaded using the developer portal under Web app \ File explorer or using deployment pipelines in GitHub, Azure DevOps or other CI/CD tools.
CORS support
Browser requests originating from a host like [app-name].restapi.cloud with a destination like <region-prefix>.restapi.com will be considered cross-origin. Some cross-origin requests require a CORS policy in place to be executed by the browser. Read more about Cross-Origin Resource Sharing (CORS).
To manage allowed origin hostnames you can use the developer portal under Security \ CORS \ Add URL .
When using hosted web apps there is no need for a CORS-policy, as the REST endpoints are available in a virtual path under the web app hostname.
Note that using the virtual path /api is a CORS-free and region-free alternative to the region-specific REST API URL.
Virtual paths
Hosted web apps contain two virtual paths that fetch content from managed resources.
Path | Description |
---|---|
<region-prefix>-api | Hostname-specific API-path that can be used as a CORS-free alternative to <region-prefix>.restapi.com/<api-path> |
api | Hostname-specific API-path that can be used as a CORS-free and region-free alternative to <region-prefix>.restapi.com/<api-path> |
login | Hosted login page |
Note that using the region-free /api path can come with a small performance penalty.
For hosted web apps you can use a virtual path to access the endpoints of an API. Virtual API paths are accessed using the following format: https://<app-host-name>/<region-prefix>-api
Examples of valid URLs using virtual paths in hosted apps:
https://sample-app.restapi.cloud/api/sample-api/sample-collection
https://sample-app.restapi.cloud/eu-api/sample-api/sample-collection
https://www.sample-app-name.com/no-api/sample-api/sample-collection