File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,22 @@ Currently, this file server has a single cache header that it can set through
4444the ` 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
4965Prerequisites:
You can’t perform that action at this time.
0 commit comments