---
title: Static content
summary: >-
  Put Fastly in front of your static web server to add smart features and
  dynamic routing at the edge.
url: https://www.fastly.com/documentation/solutions/use-cases/static-content
---


import SolutionsProvider from '~providers/solutions'
import SolutionsTable from '~components/solutions-table/solutions-table'

<p class='lead'>A huge amount of the content on the web is static. Delivering that content should be simple, cost-effective, do everything you'd expect of a modern website, and not get in the way of the dynamic parts of your user experience.</p>

<Video type='youtube' id='R9_xRDrz_V0' />

## Fastly features

Static hosting providers vary in the feature set they provide and a variety of Fastly features can be helpful. When defining a backend, you should almost always configure a [host header override](/guides/integrations/non-fastly-services/developer-guide-backends/#overriding-the-host-header) and this is usually necessary for static content hosting providers like AWS S3 and Google's Cloud Storage. [Learn more](/guides/integrations/non-fastly-services/developer-guide-backends/#overriding-the-host-header)

Most other actions you may find useful in dealing with static content hosting can be implemented in VCL or your preferred Compute language.

## Ideas and typical uses

Here are some of the things that customers putting Fastly in front of a static hosting provider or storage bucket will typically do:

- Some bucket hosts may require a [path prefix](/guides/integrations/non-fastly-services/developer-guide-backends/#modifying-the-request-path).
- You may need to [add /index.html to bare directory URLs](/guides/integrations/non-fastly-services/developer-guide-backends/#redirecting-for-directory-indexes).
- To avoid serving ugly error pages, consider detecting and [replacing error responses with custom error pages](/guides/integrations/non-fastly-services/developer-guide-backends/#customizing-error-pages).
- It's better to have the cache TTL of an object defined at the origin, but if that's not possible you could [override the cache lifetime](/guides/integrations/non-fastly-services/developer-guide-backends/#setting-cache-lifetime-ttl).
- Consider removing extraneous HTTP headers like `x-amz-request-id` or `x-goog-hash`, and adding best practice security headers like `Content-Security-Policy`. [Learn more](/guides/integrations/non-fastly-services/developer-guide-backends/#removing-metadata).
- You may want to ensure that [traffic to the backend host comes only from Fastly](/guides/integrations/non-fastly-services/developer-guide-backends/#ensuring-backend-traffic-comes-only-from-fastly).
- When you move objects around in your buckets, redirect the old paths at the edge.

## Solutions

<SolutionsProvider useCase='static-content' render={(nodes) => (
  <SolutionsTable nodes={nodes} />
)} />

## Real world usage

Many Fastly customers incorporate static content delivery into their Fastly services.

### curl

The [curl](https://curl.se/) project, beloved of developers everywhere for it's straightforward but powerful ability to wrangle HTTP requests on the command line, fronts its website using Fastly, as part of our [Fast Forward](https://www.fastly.com/fast-forward) program. curl's main developer [Daniel Stenberg](https://twitter.com/bagder) is a fan:

> The curl website is almost entirely a set of generated static HTML and CSS pages. They are built from source files that trigger a rebuild when anyone of them is updated. A static website is snappy to serve, cache-friendly and it is easy to run a local copy of it on your own dev machine to try out website changes before you deploy.

## Blogs and articles

- [No origin, static websites at the edge](https://www.fastly.com/blog/no-origin-static-websites-at-the-edge)
- [Purging Fastly using Google Cloud functions](https://www.fastly.com/blog/purge-fastly-gcp-cloud-functions)
