Skip to content

Commit d7aed51

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

1 file changed

Lines changed: 35 additions & 2 deletions

File tree

  • src/variations/frankenphp/etc/frankenphp

src/variations/frankenphp/etc/frankenphp/Caddyfile

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,35 @@ 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+
115+
handle @wellknown-allowed {
116+
file_server
117+
}
118+
119+
# Block everything else under .well-known
120+
@wellknown-blocked path /.well-known/*
121+
respond @wellknown-blocked 403
122+
94123
php_server {
95124
{$CADDY_PHP_SERVER_OPTIONS}
96125
}
@@ -127,8 +156,12 @@ fd00::/8 \
127156
}
128157

129158
(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 */.*
159+
# Reject dot files and certain file extensions, excluding .well-known/
160+
@rejected {
161+
path *.bak *.conf *.dist *.fla *.ini *.inc *.inci *.log *.orig *.psd *.sh *.sql *.swo *.swp *.swop */.*
162+
# .well-known needs to be whitelisted, further handling in php-app-common
163+
not path /.well-known/*
164+
}
132165

133166
# Return 403 Forbidden for rejected files
134167
respond @rejected 403

0 commit comments

Comments
 (0)