-
Notifications
You must be signed in to change notification settings - Fork 0
/
Caddyfile
42 lines (35 loc) · 1.02 KB
/
Caddyfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# global options
{
admin off # theres no need for the admin api in railway's environment
persist_config off # storage isn't persistent anyway
# auto_https off # railway handles https for us, this would cause issues if left enabled
# runtime logs
log {
format json # set runtime log format to json mode
output file /var/log/caddy/global-log.json
}
# server options
servers {
trusted_proxies static private_ranges # trust railway's proxy
}
debug
}
# site block, listens on the $PORT environment variable, automatically assigned by railway
# :{$PORT} {
:3000 {
# access logs
log {
format json # set access log format to json mode
output file /var/log/caddy/localhost-log.json
}
# health check for railway
respond /health 200
# serve from the 'build' folder (react-scripts builds into the 'build' folder)
root * /srv
# enable gzipping responses
encode gzip
# serve files from 'build'
file_server
# if path doesn't exist, redirect it to 'index.html' for client side routing
try_files {path} index.html
}