Skip to content

Commit

Permalink
Add Caddy to external web server docs (#57)
Browse files Browse the repository at this point in the history
* Add Caddy to external web server docs

* Update ExternalWebserversFile.md

Align to wiki example

* Ignore Accept-Encoding

We can't serve any other encoding anyway
  • Loading branch information
tjvr authored Jan 20, 2024
1 parent be81015 commit ae863ca
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions wiki/webserver/ExternalWebserversFile.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,34 @@ ProxyPassMatch ^/(maps/[^/]*/live/.*) http://127.0.0.1:8100/$1
> **Important:**<br>
> The above config is **just an example** and not a complete config you can just copy&paste. You **will** need to adapt it to your setup!
{: .info .important }

## Caddy
Newer versions of [Caddy](https://caddyserver.com/) have a `precompressed` option that's similar to Nginx's `gzip_static`. Unfortunately this [requires the "base" file](https://github.com/caddyserver/caddy/issues/5116) `.json` to also exist, but Bluemap only creates the "precompressed" files `.json.gz`.

Here is the required config to serve the high-res `.json.gz` files correctly:
```caddyfile
http://your-domain {
root * /usr/share/caddy/
file_server
reverse_proxy /live/* http://127.0.0.1:8100
@JSONgz {
path *.json
file {
try_files {path}.gz
}
}
handle @JSONgz {
rewrite {http.matchers.file.relative}
header Content-Type application/json
header Content-Encoding gzip
}
}
```

The optional config to avoid 404s in the logs is left as an exercise for the reader.

> **Important:**<br>
> The above config is **just an example** and not a complete config you can just copy&paste. You **will** need to adapt it to your setup!
{: .info .important }

0 comments on commit ae863ca

Please sign in to comment.