Skip to content

Instantly share code, notes, and snippets.

@frli
frli / deliver_snippet.vcl
Last active September 4, 2019 12:56
Serving static react apps straight from Azure Blob Storage via Fastly
if (resp.status == 404 && req.restarts == 0) {
# Routing in a React app is most of the time handled client side.
# To support a good end user experience we need to return the contents of index.html
# when the client requests a resource that does not exist server side.
# If we get a 404 response from the backend we restart the request inside Fastly
# so we can take another shot at generating a response to the client.
# This will increment the req.restarts counter.
if (req.url ~ "^/new-shiny-react-app" || req.url ~ "^/another-new-shiny-react-app") {
return (restart);

Keybase proof

I hereby claim:

  • I am frli on github.
  • I am frli (https://keybase.io/frli) on keybase.
  • I have a public key whose fingerprint is 4DDD 33E0 8692 5FA4 DDB0 E280 267F 6E04 0ADF 2A55

To claim this, I am signing this object: