Skip to content

Commit 00df1ca

Browse files
committed
Fix blocking .well-known path for FrankenPHP
1 parent 9b6868e commit 00df1ca

File tree

1 file changed

+39
-2
lines changed
  • src/variations/frankenphp/etc/frankenphp

1 file changed

+39
-2
lines changed

src/variations/frankenphp/etc/frankenphp/Caddyfile

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,39 @@ fd00::/8 \
9191
}
9292
log_skip @healthcheckpath
9393

94+
# Define specific endpoint under .well-known/
95+
# https://www.iana.org/assignments/well-known-uris/well-known-uris.xhtml
96+
# https://en.wikipedia.org/wiki/Well-known_URI
97+
@wellknown-allowed {
98+
# ACME
99+
path /.well-known/acme-challenge/*
100+
101+
# Security & identity
102+
path /.well-known/security.txt
103+
104+
# OAuth / OpenID
105+
path /.well-known/openid-configuration
106+
path /.well-known/oauth-authorization-server
107+
108+
# Mobile / platform verification
109+
# https://developer.apple.com/documentation/xcode/supporting-associated-domains
110+
path /.well-known/assetlinks.json
111+
path /.well-known/apple-app-site-association
112+
path /.well-known/apple-developer-merchantid-domain-association
113+
114+
# Passkey support
115+
path /.well-known/passkey-endpoints
116+
path /.well-known/webauthn
117+
}
118+
119+
handle @wellknown-allowed {
120+
file_server
121+
}
122+
123+
# Block everything else under .well-known
124+
@wellknown-blocked path /.well-known/*
125+
respond @wellknown-blocked 403
126+
94127
php_server {
95128
{$CADDY_PHP_SERVER_OPTIONS}
96129
}
@@ -127,8 +160,12 @@ fd00::/8 \
127160
}
128161

129162
(security) {
130-
# Reject dot files and certain file extensions
131-
@rejected path *.bak *.conf *.dist *.fla *.ini *.inc *.inci *.log *.orig *.psd *.sh *.sql *.swo *.swp *.swop */.*
163+
# Reject dot files and certain file extensions, excluding .well-known/
164+
@rejected {
165+
path *.bak *.conf *.dist *.fla *.ini *.inc *.inci *.log *.orig *.psd *.sh *.sql *.swo *.swp *.swop */.*
166+
# .well-known needs to be whitelisted, further handling in php-app-common
167+
not path /.well-known/*
168+
}
132169

133170
# Return 403 Forbidden for rejected files
134171
respond @rejected 403

0 commit comments

Comments
 (0)