+9
-5
Caddyfile
+9
-5
Caddyfile
···
2
{
3
admin off # theres no need for the admin api in railway's environment
4
persist_config off # storage isn't persistent anyway
5
-
auto_https off # railway handles https for us, this would cause issues if left enabled
6
# runtime logs
7
log {
8
format json # set runtime log format to json mode
···
22
23
reverse_proxy {$FRONTEND_HOST} # proxy all requests for /* to the frontend, configure this variable in the service settings
24
25
-
# the handle_path directive will strip /api/ from the path before proxying
26
# this is needed if your backend's api routes don't start with /api/
27
# change paths as needed
28
handle_path /api/* {
29
-
# this strips the /api/ prefix from the uri sent to the proxy address
30
reverse_proxy {$BACKEND_HOST} # proxy all requests for /api/* to the backend, configure this variable in the service settings
31
}
32
33
# if your backend's api routes do start with /api/ then you wouldn't want to strip the path prefix
34
-
# if so, comment out the above handle_path block, and uncomment this reverse_proxy directive
35
# change paths as needed
36
-
# reverse_proxy {$BACKEND_HOST} # configure this variable in the service settings
37
}
···
2
{
3
admin off # theres no need for the admin api in railway's environment
4
persist_config off # storage isn't persistent anyway
5
+
auto_https off # railway handles https for us, this could in some cases cause issues if left enabled
6
# runtime logs
7
log {
8
format json # set runtime log format to json mode
···
22
23
reverse_proxy {$FRONTEND_HOST} # proxy all requests for /* to the frontend, configure this variable in the service settings
24
25
+
# the handle_path directive WILL strip /api/ from the path before proxying
26
# this is needed if your backend's api routes don't start with /api/
27
# change paths as needed
28
handle_path /api/* {
29
+
# the /api/ prefix WILL be stripped from the uri sent to the proxy host
30
reverse_proxy {$BACKEND_HOST} # proxy all requests for /api/* to the backend, configure this variable in the service settings
31
}
32
33
+
# this handle directive will NOT strip /api/ from the path before proxying
34
# if your backend's api routes do start with /api/ then you wouldn't want to strip the path prefix
35
+
# if so, comment out the above handle_path and reverse_proxy directives, and uncomment these handle and reverse_proxy directives
36
# change paths as needed
37
+
# handle /api/* {
38
+
# the /api/ prefix will NOT be stripped from the uri sent to the proxy host
39
+
# reverse_proxy {$BACKEND_HOST} # proxy all requests for /api/* to the backend, configure this variable in the service settings
40
+
# }
41
}