To discover whether your Object Storage system supports this feature, see the section called “Discoverability”. Alternatively, check with your service provider.
You can use your Object Storage account to create a static
website. This mode is normally only active for anonymous
requests, which provide no authentication token. To use it
with authenticated requests, set the header
X-Web-Mode
to TRUE
on the request. To determine whether the static website
feature is enabled, contact your service provider.
For example:
[DEFAULT] ... [pipeline:main] pipeline = healthcheck cache tempauth staticweb proxy-server ... [filter:staticweb] use = egg:swift#staticweb # Seconds to cache container x-container-meta-web-* header values. # cache_timeout = 300 # You can override the default log routing for this filter here: # set log_name = staticweb # set log_facility = LOG_LOCAL0 # set log_level = INFO # set access_log_name = staticweb # set access_log_facility = LOG_LOCAL0 # set access_log_level = INFO # set log_headers = False
Your publicly readable containers are checked for two
headers, X-Container-Meta-Web-Index
and
X-Container-Meta-Web-Error
. (The latter
header is discussed below, under Set
error pages for static website.) With
X-Container-Meta-Web-Index
, you
determine the index file (or default page served, such as
index.html
) displays your website. When
someone initially enters your site, they don't have to specify
the index file; index.html file displays automatically. If you
create sub-directories for your site by creating
pseudo-directories in your container, the index page displays
by default for each sub-directory. If your pseudo-directory
does not have a file with the same name as your index file,
visits to the sub-directory return a 404 error.
You also have the option of displaying a list of files in
your pseudo-directory instead of a web page. You do this by
setting the X-Container-Meta-Web-Listings
header to TRUE
. You may add style to your
file listing by setting
X-Container-Meta-Web-Listings-CSS:
to a
style sheet (for example,
lists.css
).