Skip to content

Commit 6f23528

Browse files
committed
docs: list valid status codes and add default destination in README.md
Signed-off-by: Thorsten Hans <[email protected]>
1 parent 6bbdfa6 commit 6f23528

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,21 @@ The following table outlines available configuration values:
1515

1616
| Key | Description | Default Value |
1717
|---------------|-------------------------------------------------------|------------------|
18-
| `destination` | Where should the component redirect to | *(empty string)* |
18+
| `destination` | Where should the component redirect to | `/` |
1919
| `statuscode` | What HTTP status code should be used when redirecting | `302` |
2020

2121
The `spin-redirect` component tries to look up the config value in the Spin component configuration using the keys shown in the table above (lower case). If desired key is not present, it transforms the key to upper case (e.g., `DESTINATION`) and checks environment variables.
2222

23+
### Valid redirection status codes
24+
25+
The `spin-redirect` component supports the following HTTP status codes to perform a redirect:
26+
27+
- `301` Moved Permanently
28+
- `302` Found (Moved Temporarily)
29+
- `303` See Other: Only supported for `PUT` and `POST` requests
30+
- `307` Temporary Redirect
31+
- `308` Permanent Redirect
32+
2333
## Example usage
2434

2535
The following snippet shows how to add and configure `spin-redirect` in your `spin.toml` using environment variables
@@ -54,9 +64,11 @@ version = "0.1.0"
5464
[[component]]
5565
id = "redirect-sample"
5666
source = "path/to/redirect.wasm"
67+
5768
[component.config]
5869
destination="/index.html"
5970
statuscode="301"
71+
6072
[component.trigger]
6173
route = "/"
6274

0 commit comments

Comments
 (0)