@@ -52,7 +52,7 @@ config since you'll need it later.
52
52
53
53
Because the Minecraft server (and therefore the integrated BlueMap webserver) is not always going to
54
54
be online, we need to use something else to host the BlueMap webapp and resources. This guide will
55
- provide a configuration example for [ Nginx] , but the same general idea can be applied to any other
55
+ provide configuration examples for [ Nginx] and [ Caddy ] , but the same general idea can be applied to any other
56
56
webserver as well.
57
57
58
58
Most of this configuration is going to be the exact same as is detailed on the [ External Webservers
@@ -118,6 +118,53 @@ server {
118
118
}
119
119
}
120
120
```
121
+
122
+ ## Example Caddy config
123
+
124
+ ```
125
+ yourdomain.com {
126
+ # Path to bluemap-webroot, BlueMap can also be used in a sub-folder .. just adapt the paths accordingly
127
+ root * /var/www
128
+
129
+ # Catch the error and serve "live" data from the disk when the integrated webserver can't be reached
130
+ handle_errors {
131
+ try_files {path} =204
132
+ file_server {
133
+ # Replace the error status preserved from the reverse_proxy directive
134
+ status 200
135
+ }
136
+ }
137
+
138
+ # Match the textures.json file & .prbm files
139
+ @gz path /maps/*/textures.json *.prbm
140
+ # Find .gz files (if not found respond with 204) for the above matcher, and set the "Content-Encoding gzip" header
141
+ handle @gz {
142
+ try_files {path}.gz =204
143
+ header Content-Encoding gzip
144
+ }
145
+
146
+ # Respond with 204 for non-existant map-tiles
147
+ @204 path */tiles/*
148
+ handle @204 {
149
+ try_files {path} =204
150
+ }
151
+
152
+ # Proxy requests for live data to the bluemaps integrated webserver.
153
+ # Trigger an error and fall back to our local files if the server can't be reached.
154
+ @live path /maps/*/live/*
155
+ handle @live {
156
+ reverse_proxy 127.0.0.1:8100 { # Adapt to your setup
157
+ # We don't want the request to hang indefinitely so we trigger a timeout error after 3s
158
+ transport http {
159
+ response_header_timeout 3s
160
+ }
161
+ }
162
+ }
163
+
164
+ file_server
165
+ }
166
+ ```
167
+
121
168
> ** Important:** <br >
122
169
> The above config is ** just an example** and not a complete config you can just copy&paste. You
123
170
> ** will** need to adapt it to your setup!
@@ -126,5 +173,6 @@ server {
126
173
127
174
[ lazymc ] :https://github.com/timvisee/lazymc
128
175
[ Nginx ] : https://nginx.org/
176
+ [ Caddy ] : https://caddyserver.com/
129
177
[ External Webservers (FILE-Storage)] : {% link wiki/webserver/ExternalWebserversFile.md %}
130
178
[ Getting Started] : {% link wiki/getting-started/index.md %}
0 commit comments