COPY'> GET'> HEAD'> PUT'> POST'> DELETE'> '> '> ]>
Create Static Website You can use your swift account to create a static website. This mode is normally only active for anonymous requests. To use it with authenticated requests, set the header X-Web-Mode to TRUE on the request. The staticweb filter should be added to the pipeline in your /etc/swift/proxy-server.conf file just after any auth middleware. Beneath the pipeline, the staticweb middleware configuration must be added. For example: Your publicly readable containers will be 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).
Static Web Middleware through swift Make Container Publicly Readable Make the container publicly readable. Once the container is publicly readable, you may access your objects directly, but you will need to 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 displays. swift post -m 'web-index:index.html' container Enable File Listing Turn on file listing. If you do not set the index file, list the objects in the container. Instructions on styling the list with the CSS follow. swift post -m 'web-listings: true' container Enable CSS for File Listing Style the file listing.
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 prepended 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. Set the X-Container-Meta-Web-Error metadata once for your entire static website. Set Error Pages for Static Website Request Any 2xx response indicates success.