Skip to main content

Static Hosting Management

Resource Management

You can access the CloudBase Console to directly manage your static website, upload and delete files, create folders, and perform other operations.

Note
  • The static website hosting service does not require manual start or stop by users. If no resources are hosted, the service is automatically paused.
  • When uploading files and folders, the naming of folders and files can only contain a combination of numbers, Chinese, and English characters, and is limited to 255 characters.

Domain Management

CloudBase static hosting provides a default domain name for testing purposes. You can use the default domain name to test access to the static website. The default domain name has certain access frequency limits; if the access frequency limit is exceeded, the default domain name will become inaccessible.

Note

To avoid access frequency limits, we recommend setting your own custom domain as the public-facing service domain. For details, see Custom Domain.

HTTPS

CloudBase static hosting's default domain supports HTTP and HTTPS access without any configuration.

To enable HTTPS for a custom domain, you must first upload an SSL certificate on the console.

If you want your website to enforce force HTTPS, first bind a custom domain, then enable the "Force HTTPS" option. For details, see Custom Domain.

Index Documents

  • When a user accesses the root directory or any subdirectory of a website, CloudBase will return the index document in that directory. The index document defaults to index.html.
  • When a user accesses the root directory or a subdirectory of a website, the page corresponding to the index document will be returned. It is recommended to set the index document uniformly to index.html in both the root directory and subdirectories.

Redirect Rules

You can define a series of redirect rules for your website, typically used for:

  • When a file is deleted, moved, or renamed, the old URL can be redirected to the new one.
  • Shorten URLs. For example, you can redirect example.com/team to example.com/about.html.

Redirect rules are divided into two types: error code and prefix matching.

Note
  • The priority of redirect rules is greater than the index document configuration.
  • In redirect rules, the replacement path supports file or folder paths within static website hosting. Do not include domain name content. For example, if you fill in https://xxx.com/docs as the replacement path, the file path cannot be found. You only need to fill in docs/.

Error Code Redirect

Currently, redirect rules only support configuration for 4xx error codes (e.g., 404). You can optionally customize error pages. If a user triggers a corresponding HTTP error, you can provide additional guidance to your users on that error page.

Prefix Matching Redirect

You can use prefix matching rules to configure redirects for files or folders in the bucket.

For example, when you rename the docs folder under the root directory to documents, access to the docs folder will result in a 404 error. In this case, you can redirect requests with the prefix docs/ to the documents/ folder.

Cache Configuration

CloudBase static hosting supports setting file cache time. You can configure cache duration for the following types of files:

  • Specific file extensions, such as .jpg;.png;
  • Folders, such as `/test;/foo;/bar
  • Files, such as `/static/*.js
Note
  • The browser-configured cache time will appear in the HTTP response headers of the resource as cache-control: max-age=<time>.
  • When uploading files/folders in the console, the cache files in the node will be automatically refreshed.
  • Cache configuration is divided into browser cache configuration and node cache configuration. When a user accesses a resource, the browser cache is first checked. If no cache exists, the request is sent to the node. If the node has a cache, the resource is returned; otherwise, it is fetched from the origin.

Security Configuration

CloudBase static hosting supports configurations such as referer blocklist/allowlist, IP blocklist/allowlist, and IP access rate limiting to prevent malicious programs from leeching public network traffic using resource URLs or maliciously leeching resources.

Configure a blocklist or allowlist to set up hotlink protection.

  • Blocklist: Deny specified domains from accessing static resources.
  • Allowlist: Allow specified domains to access static resources.

Requests identified as illegal will receive a 403 response.

Note

CloudBase identifies the referer field in the HTTP request header as the criterion for determining the source domain.

IP Blocklist/Allowlist

You can configure IP blocklist/allowlist to block/allow specific IPs from accessing static resources, supporting IPv4 and its CIDR formats (/8, /16, /24) as well as full IPv6 addresses.

Requests identified as illegal will receive a 403 response.

IP Access Rate Limiting

You can configure IP access rate limiting to prevent certain IPs from excessive resource consumption.

Note

Single IP access rate limiting can defend against some CC attacks (Challenge Collapsar), but it may also affect your website access. Please modify with caution.