From f411015349f9540f3ee2891dd8bfa0e2edc98600 Mon Sep 17 00:00:00 2001 From: Erik Wilson Date: Tue, 20 Jan 2015 14:49:35 -0600 Subject: [PATCH] Adds static website information to End User Guide With the moving of the Object Storage API content from a long-form dev guide to a specification, some topics needed To be added to the End User Guide. Change-Id: Ib0c015ceb28a67974a960f8bf270e839e00c3773 Partial-bug: 1392382 --- doc/user-guide/section_cli_swift_howto.xml | 1 + .../section_object-api-create-website.xml | 115 ++++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 doc/user-guide/section_object-api-create-website.xml diff --git a/doc/user-guide/section_cli_swift_howto.xml b/doc/user-guide/section_cli_swift_howto.xml index f0604384d9..a01d9f82bf 100644 --- a/doc/user-guide/section_cli_swift_howto.xml +++ b/doc/user-guide/section_cli_swift_howto.xml @@ -136,4 +136,5 @@ X-Timestamp: 1392684036.33306 + diff --git a/doc/user-guide/section_object-api-create-website.xml b/doc/user-guide/section_object-api-create-website.xml new file mode 100644 index 0000000000..71bb8270e4 --- /dev/null +++ b/doc/user-guide/section_object-api-create-website.xml @@ -0,0 +1,115 @@ + +
+ Create static website + You can use your Object Storage account to create a static + website. This static website is created with staticweb + middleware and serves container data with a specified index + file, error file resolution, and optional file listings. This + mode is normally active only 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. + The staticweb filter must be added to the pipeline in your + /etc/swift/proxy-server.conf file + below any authentication middleware. You must also add a + staticweb middleware configuration section. + For an example of the staticweb configuration syntax see the + Cloud Administrator Guide. + For a complete example of the + /etc/swift/proxy-server.conf file + (including staticweb), see the Cloud Administrator Guide. + Your publicly readable containers are checked for two + headers, X-Container-Meta-Web-Index and + X-Container-Meta-Web-Error. The + X-Container-Meta-Web-Error header is + discussed below, in . + Use X-Container-Meta-Web-Index to + determine the index file (or default page served, such as + index.html) for your website. When + someone initially enters your site, the + index.html file displays + automatically. If you create sub-directories for your site by + creating pseudo-directories in your container, the index page + for each sub-directory is displayed by default. 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. To do this, set + the X-Container-Meta-Web-Listings header to + TRUE. You may add styles to your file + listing by setting + X-Container-Meta-Web-Listings-CSS: to a + style sheet (for example, + lists.css). +
+ Static web middleware through Object Storage + + Make container publicly readable + Make the container publicly readable. Once the + container is publicly readable, you can access your + objects directly, but you must set the index file to + browse the main site URL and its + sub-directories. + $ swift post -r '.r:*' container + + + Set site index file + Set the index file. In this case, + index.html is the default + file displayed when the site appears. + $ swift post -m 'web-index:index.html' container + + + Enable file listing + Turn on file listing. If you do not set the index + file, the URL displays a list of the objects in the + container. Instructions on styling the list with a CSS + follow. + $ swift post -m 'web-listings: true' container + + + Enable CSS for file listing + Style the file listing using a CSS. + $ swift post -m 'web-listings-css:listings.css' container + +
+
+ Set error pages for static website + You can create and set custom error pages for visitors + to your website; currently, only 401 (Unauthorized) and + 404 (Not Found) errors are supported. To do this, set the + metadata header, + X-Container-Meta-Web-Error. + Error pages are served with the <status> code + pre-pended to the name of the error page you set. For + instance, if you set + X-Container-Meta-Web-Error to + error.html, 401 errors will + display the page 401error.html. + Similarly, 404 errors will display + 404error.html. You must have both + of these pages created in your container when you set the + X-Container-Meta-Web-Error + metadata, or your site will display generic error + pages. + You only have to set the + X-Container-Meta-Web-Error metadata + once for your entire static website. + + Set error pages for static website request + $ swift post -m 'web-error:error.html' container + + Any 2nn response indicates + success. +
+