Skip to content

Update BluemapLazyServer.md - Caddy example #107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 12, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 49 additions & 1 deletion community/BluemapLazyServer.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ config since you'll need it later.

Because the Minecraft server (and therefore the integrated BlueMap webserver) is not always going to
be online, we need to use something else to host the BlueMap webapp and resources. This guide will
provide a configuration example for [Nginx], but the same general idea can be applied to any other
provide configuration examples for [Nginx] and [Caddy], but the same general idea can be applied to any other
webserver as well.

Most of this configuration is going to be the exact same as is detailed on the [External Webservers
Expand Down Expand Up @@ -118,6 +118,53 @@ server {
}
}
```

## Example Caddy config

```caddy
yourdomain.com {
# Path to bluemap-webroot, BlueMap can also be used in a sub-folder .. just adapt the paths accordingly
root * /var/www

# Catch the error and serve "live" data from the disk when the integrated webserver can't be reached
handle_errors {
try_files {path} =204
file_server {
# Replace the error status preserved from the reverse_proxy directive
status 200
}
}

# Match the textures.json file & .prbm files
@gz path /maps/*/textures.json *.prbm
# Find .gz files (if not found respond with 204) for the above matcher, and set the "Content-Encoding gzip" header
handle @gz {
try_files {path}.gz =204
header Content-Encoding gzip
}

# Respond with 204 for non-existant map-tiles
@204 path */tiles/*
handle @204 {
try_files {path} =204
}

# Proxy requests for live data to the bluemaps integrated webserver.
# Trigger an error and fall back to our local files if the server can't be reached.
@live path /maps/*/live/*
handle @live {
reverse_proxy 127.0.0.1:8100 { # Adapt to your setup
# We don't want the request to hang indefinitely so we trigger a timeout error after 3s
transport http {
response_header_timeout 3s
}
}
}

file_server
}
```

> **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!
Expand All @@ -126,5 +173,6 @@ server {

[lazymc]:https://github.com/timvisee/lazymc
[Nginx]: https://nginx.org/
[Caddy]: https://caddyserver.com/
[External Webservers (FILE-Storage)]: {% link wiki/webserver/ExternalWebserversFile.md %}
[Getting Started]: {% link wiki/getting-started/index.md %}