mirror of
https://github.com/caddyserver/website.git
synced 2025-04-21 12:36:16 -04:00
Add Cache-Control "public,max-age=0,must-revalidate" to index.html in SPA Example (#410)
Co-authored-by: Francis Lavoie <lavofr@gmail.com>
This commit is contained in:
parent
4a71f732b2
commit
13367a80ce
1 changed files with 9 additions and 0 deletions
|
@ -241,6 +241,15 @@ example.com {
|
|||
}
|
||||
```
|
||||
|
||||
If your `index.html` is static, you may want to consider adding a `Cache-Control` header to instruct clients to cache it. Since the `try_files` rewrite is used to serve it from other paths, you can wrap the `try_files` with a `route` so that the `header` handler runs after the rewrite (it normally would run before due to the [directive order](/docs/caddyfile/directives#directive-order)):
|
||||
|
||||
```caddy-d
|
||||
route {
|
||||
try_files {path} /index.html
|
||||
header /index.html Cache-Control "public, max-age=0, must-revalidate"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Caddy proxying to another Caddy
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue