-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCaddyfile
47 lines (43 loc) · 1.33 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
43
44
45
46
47
{
auto_https off
}
:3000 {
# All auth-related routes should go to the next-auth app
handle /api/auth/* {
reverse_proxy http://host.docker.internal:3002
}
handle /api/is-authed {
reverse_proxy http://host.docker.internal:3002
}
handle /api/login {
reverse_proxy http://host.docker.internal:3002
}
# Static Assets should not have auth information forwarded
handle /_next/* {
reverse_proxy http://host.docker.internal:3001
}
# Example of a page that would be auto-redirected to login
handle /private-page {
forward_auth http://host.docker.internal:3002 {
uri /api/is-authed
copy_headers X-Auth-Request-Access-Token
@error status 401
handle_response @error {
redir * /api/login?callbackUrl=/private-page
}
}
reverse_proxy http://host.docker.internal:3001
}
# All other routes should have access token available via the X-Auth-Request-Access-Token header
handle /* {
forward_auth http://host.docker.internal:3002 {
uri /api/is-authed
copy_headers X-Auth-Request-Access-Token
@error status 401
handle_response @error {
reverse_proxy http://host.docker.internal:3001
}
}
reverse_proxy http://host.docker.internal:3001
}
}