Skip to content

Commit 7e299a3

Browse files
Merge pull request #7 from spectrocloud/caddy-auth
fix: added ability for reverse proxy to insert auth token in request
2 parents 6b20501 + fc7bced commit 7e299a3

File tree

3 files changed

+38
-40
lines changed

3 files changed

+38
-40
lines changed

Caddyfile

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,41 @@
11
{
2-
debug
2+
debug
33
}
44
:8080 {
5-
encode gzip
6-
handle_path /api/* {
7-
reverse_proxy {$API_URI}
8-
}
5+
encode gzip
6+
handle_path /api/* {
7+
reverse_proxy {$API_URI}
8+
}
99

10-
handle {
11-
root * /app/build
12-
try_files {path} /index.html
13-
file_server
14-
}
10+
handle {
11+
root * /app/build
12+
try_files {path} /index.html
13+
file_server
14+
}
1515
log {
1616
output file /var/log/caddy/caddy.log {
1717
roll_size 1gb
18-
roll_keep 2
19-
roll_keep_for 720h
18+
roll_keep 2
19+
roll_keep_for 720h
2020
}
2121
format json {
22-
time_format wall
23-
}
22+
time_format wall
23+
}
2424
}
25-
2625
}
2726
:3000 {
28-
reverse_proxy {$SVC_URI}
27+
reverse_proxy /api/* {
28+
header_up Authorization "Bearer {$TOKEN}"
29+
to {$SVC_URI}
30+
}
2931
log {
3032
output file /var/log/caddy/caddy.log {
3133
roll_size 1gb
32-
roll_keep 2
33-
roll_keep_for 720h
34+
roll_keep 2
35+
roll_keep_for 720h
3436
}
3537
format json {
36-
time_format wall
37-
}
38+
time_format wall
39+
}
3840
}
39-
}
41+
}

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Hello Universe is available as a Docker image.
1616
To run Hello Universe issue the following commands:
1717

1818
```shell
19-
docker pull ghcr.io/spectrocloud/hello-universe:1.0.6
20-
docker run -p 8080:8080 ghcr.io/spectrocloud/hello-universe:1.0.6
19+
docker pull ghcr.io/spectrocloud/hello-universe:1.0.7
20+
docker run -p 8080:8080 ghcr.io/spectrocloud/hello-universe:1.0.7
2121
```
2222

2323
## Non-Docker
@@ -56,7 +56,7 @@ API_URI=http://localhost:3000
5656
If you are using the Docker image then use the `-e` flag parameter.
5757

5858
```shell
59-
docker run -p 8080:8080 -e API_URI=http://localhost:3000 ghcr.io/spectrocloud/hello-universe:1.0.6
59+
docker run -p 8080:8080 -e API_URI=http://localhost:3000 ghcr.io/spectrocloud/hello-universe:1.0.7
6060
```
6161

6262
### Reverse Proxy

local-caddyfile

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
1-
:8080 {
2-
encode gzip
3-
handle_path /api/* {
4-
reverse_proxy http://0.0.0.0:3000
1+
{
2+
debug
3+
}
4+
:3000 {
5+
reverse_proxy /api/* {
6+
header_up Authorization "Bearer {$TOKEN}"
7+
to {$SVC_URI}
58
}
6-
7-
handle {
8-
root * build/
9-
try_files {path} /index.html
10-
file_server
11-
}
12-
9+
1310
log {
1411
output file caddy.log {
1512
roll_size 1gb
16-
roll_keep 2
17-
roll_keep_for 720h
13+
roll_keep 2
14+
roll_keep_for 720h
1815
}
1916
format json {
20-
time_format wall
21-
}
17+
time_format wall
18+
}
2219
}
23-
2420
}

0 commit comments

Comments
 (0)