-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathCaddyfile
More file actions
57 lines (50 loc) · 1.3 KB
/
Caddyfile
File metadata and controls
57 lines (50 loc) · 1.3 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# 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 could in some cases cause issues if left enabled
# runtime logs
log {
output discard
}
servers {
trusted_proxies static private_ranges # trust railway's proxy
}
}
(cors) {
@cors_preflight_{args[0]} {
method OPTIONS
header Origin {args[0]}
}
@cors_{args[0]} header Origin {args[0]}
handle @cors_preflight_{args[0]} {
header {
Access-Control-Allow-Origin "{args[0]}"
Access-Control-Allow-Methods "GET, POST, PUT, PATCH, DELETE, OPTIONS"
Access-Control-Allow-Headers *
Access-Control-Max-Age "3600"
defer
}
respond "" 204
}
handle @cors_{args[0]} {
header {
Access-Control-Allow-Origin "{args[0]}"
Access-Control-Expose-Headers *
defer
}
}
}
# site block, listens on the $PORT environment variable, automatically assigned by railway
:{$PORT} {
import cors {$ORIGIN_0}
import cors {$ORIGIN_1}
import cors {$ORIGIN_2}
import cors {$ORIGIN_3}
import cors {$ORIGIN_4}
reverse_proxy /* http://{$LISTMONK_app__address} {
header_up Host {upstream_hostport}
header_down Upgrade-Insecure-Requests "1"
header_down Content-Security-Policy "upgrade-insecure-requests"
}
}