Skip to content

Commit 3481636

Browse files
committed
Caddyfile
1 parent 60ccc5b commit 3481636

File tree

5 files changed

+50
-52
lines changed

5 files changed

+50
-52
lines changed

.env

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# If you don't have your own domain (highly recommended)
33
# comment this out for first deployment, add your fly.dev domain here
44
# then reset your secrets and redeploy your app (untested)
5-
CADDY_DOMAIN=domain.name.com
5+
DOMAIN_NAME=domain.name.com
66

77
###################
88
# E-mail settings #

Dockerfile

+3-6
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ ARG SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0.
77

88
ENV TZ="Asia/Shanghai" \
99

10-
CADDY_DOMAIN= \
11-
CADDY_PORT=80 \
12-
GOTIFY_SERVER_PORT=8080 \
10+
DOMAIN_NAME= \
1311

1412
OVERMIND_CAN_DIE=caddy,crontab \
1513
OVERMIND_PROCFILE=/Procfile \
@@ -29,8 +27,8 @@ ENV TZ="Asia/Shanghai" \
2927

3028
COPY config/crontab \
3129
config/Procfile \
30+
config/Caddyfile \
3231
scripts/restic.sh \
33-
scripts/caddy.sh \
3432
/
3533

3634
RUN apt update && apt install -y --no-install-recommends \
@@ -65,7 +63,6 @@ RUN apt update && apt install -y --no-install-recommends \
6563

6664
&& chmod +x /usr/local/bin/supercronic \
6765
&& chmod +x /usr/local/bin/overmind \
68-
&& chmod +x /restic.sh \
69-
&& chmod +x /caddy.sh
66+
&& chmod +x /restic.sh
7067

7168
ENTRYPOINT ["overmind", "start"]

config/Caddyfile

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
# HTTPS/TLS is handled by Fly or on your domain (eg: Cloudflare)
3+
auto_https off
4+
admin off
5+
persist_config off
6+
7+
log {
8+
output stdout
9+
format console
10+
}
11+
}
12+
13+
{$DOMAIN_NAME}:80 {
14+
encode zstd gzip
15+
16+
header / {
17+
# Enable HTTP Strict Transport Security (HSTS)
18+
Strict-Transport-Security "max-age=31536000;"
19+
# Enable cross-site filter (XSS) and tell browser to block detected attacks
20+
X-XSS-Protection "1; mode=block"
21+
# Disallow the site to be rendered within a frame (clickjacking protection)
22+
X-Frame-Options "DENY"
23+
# Prevent search engines from indexing
24+
X-Robots-Tag "noindex, nofollow"
25+
# Disallow sniffing of X-Content-Type-Options
26+
X-Content-Type-Options "nosniff"
27+
# Server name removing
28+
-Server
29+
# Remove X-Powered-By though this shouldn't be an issue, better opsec to remove
30+
-X-Powered-By
31+
# Remove Last-Modified because etag is the same and is as effective
32+
-Last-Modified
33+
}
34+
35+
route /health {
36+
respond "Hello, world!"
37+
}
38+
39+
reverse_proxy localhost:8080 {
40+
# Send the true remote IP to Rocket, so that vaultwarden can put this in the log
41+
@cloudflare header Cf-Connecting-Ip *
42+
header_up @cloudflare X-Real-IP {http.request.header.Cf-Connecting-Ip}
43+
header_up !@cloudflare X-Real-IP {remote_host}
44+
}
45+
}

config/Procfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
gotify: cd /app && ./gotify-app
2-
caddy: /caddy.sh
2+
caddy: caddy run --config /Caddyfile
33
crontab: supercronic /crontab

scripts/caddy.sh

-44
This file was deleted.

0 commit comments

Comments
 (0)