Skip to content

Commit ae24db6

Browse files
author
Justin Pflueger
committed
add fallback path to readme
Signed-off-by: Justin Pflueger <[email protected]>
1 parent 052f1d9 commit ae24db6

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

readme.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,22 @@ Currently, this file server has a single cache header that it can set through
4444
the `CACHE_CONTROL` environment variable. If no value is set, the default
4545
`max-age=60` is used instead for all media types.
4646

47+
### Setting the fallback path
48+
49+
You can configure a `FALLBACK_PATH` environment variable that points to a file that
50+
will be returned instead of the default 404 Not Found response. If no environment
51+
value is set, the default behavior is to return a 404 Not Found response. This behavior
52+
is useful for Single Page Applications that use view routers on the front-end like React and Vue.
53+
54+
```toml
55+
# For more on configuring a component, see: https://spin.fermyon.dev/configuration/
56+
[[component]]
57+
source = "target/wasm32-wasi/release/spin_static_fs.wasm"
58+
id = "fs"
59+
files = [{ source = "test", destination = "/" }]
60+
environment = { FALLBACK_PATH = "index.html" }
61+
```
62+
4763
### Building from source and using
4864

4965
Prerequisites:

0 commit comments

Comments
 (0)