Commit 063e8a3
committed
nginx: allow /.well-known/* to reach the app (RFC 8615)
The catch-all dotfile block (`location ~ /\.`) was 404'ing every
request whose path started with `/.well-known/` before nginx ever
forwarded it to PHP. That broke OIDC discovery, OAuth authorization-
server metadata, security.txt, and ACME http-01 challenges — anything
RFC 8615 says belongs in the well-known namespace.
Symptom that surfaced this: id.cbox.systems/.well-known/jwks.json
returned `<center>nginx</center>` 404 even though Laravel had the
route registered (`oauth.jwks → JwksController`). Vault's OIDC
backend can't be configured without id's discovery endpoint
reachable, so this is a hard prerequisite for vault bootstrap.
Fix:
* Add `location ^~ /.well-known/` BEFORE the regex catch-all in
both `default.conf` and `default-rootless.conf`. The `^~`
modifier short-circuits regex evaluation when the prefix matches,
so the dotfile block stops winning for this specific path. Apps
that don't register a /.well-known/* route still get a Laravel
404 (404-from-app), not a 403-from-nginx.
* Three new test-security.sh assertions:
- /.well-known/openid-configuration must NOT return 403
- response body must NOT be the nginx default-error page
- /.env must STILL be blocked (regression guard against the
well-known allow over-broadening into other dotfiles)
Verified via `docker run nginx:1.27-alpine nginx -t` against both
configs — syntax clean.1 parent c0c488d commit 063e8a3
3 files changed
Lines changed: 63 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
166 | 181 | | |
167 | 182 | | |
168 | 183 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
165 | 180 | | |
166 | 181 | | |
167 | 182 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
140 | 173 | | |
141 | 174 | | |
142 | 175 | | |
| |||
0 commit comments