Commit Graph

1574 Commits

Author SHA1 Message Date
Matt Holt
d0a3cf0a0a Merge branch 'master' into proxy-stream-detached 2026-05-12 12:18:27 -06:00
James Hartig
77e9ce7404 reverseproxy: further prevent body closes from dial errors (#7715) 2026-05-12 12:05:50 -06:00
Rayan Salhab
a4a38c3e88 rewrite: escape file matcher paths before rewriting (#7683)
* fix: escape file matcher paths in rewrites

Preserve matched file paths containing literal '?' or '%' when try_files rewrites to http.matchers.file.relative.

* test: cover nested escaped try_files rewrite paths

* test: cover encoded slash try_files rewrite paths

* fix: assert file matcher placeholder as string

---------

Co-authored-by: cyphercodes <cyphercodes@users.noreply.github.com>
2026-05-11 17:16:33 -06:00
Matthew Holt
761347aa63 templates: Explicitly warn about misconfigurations 2026-05-11 16:45:49 -06:00
Steffen Busch
4ba16fe82c docs: add documentation for fileExists and fileStat template functions (#7700) 2026-05-12 04:23:58 +10:00
Rijul
0fab9f0f7d caddytls: avoid duplicate automation for wildcard-covered hosts (#7697)
* caddytls: Fix wildcard race in auto-HTTPS launch

When evaluating whether to skip managing an individual subdomain
due to an existing wildcard configuration, we now explicitly consult
the automate loader.

Because Caddy apps can start in any order, relying strictly on the
TLS app's internal management state was non-deterministic if the
HTTP app started first. Checking the automate loader guarantees
predictable behavior since it is fully populated during the
Provision phase, well before any apps are started.

* respond to review comments

1. update requested comment
2. remove personal domain from test
3. add regression test

* remove unnecessary mutex lock

* refactor: -integration test, +explicit cases

* refactor: remove redundant test, add comment

* rename file and add header

* update copyright year
2026-05-11 00:08:40 +10:00
Zen Dodd
5e76b5ee43 tls: add alpn to managed HTTPS records (#7653)
* tls: add alpn to managed HTTPS records

* tls: centralise HTTPS RR ALPN defaults and registration

Reuse shared protocol defaults instead of repeating the default HTTP protocol list, unify server name registration to carry ALPN in one experimental API and reuse the TLS default ALPN ordering for HTTPS RR publication

* http: centralise effective protocol resolution for HTTPS RR ALPN
2026-05-10 13:10:29 +10:00
Matthew Holt
9c78b97f9e fastcgi: Fix lint 2026-05-08 10:46:28 -06:00
Kévin Dunglas
fb324331f4 Merge commit from fork
Both fallbacks in splitPos relied on golang.org/x/text/search with
search.IgnoreCase, which performs Unicode equivalence matching far beyond
ASCII case folding. Combined with the validated-ASCII guarantee on every
SplitPath entry, that fallback turned non-PHP filenames into PHP scripts:

- when the inner loop hit a non-ASCII byte and the IndexString fallback
  returned -1, the loop broke without resetting match=false, so a stale
  match=true caused a non-existent .php to be reported (PoC:
  "/name.<U+00A1>.txt").
- search.IgnoreCase folded fullwidth, mathematical and circled letters
  onto ASCII, so "/shell.<math sans-serif php>",
  "/shell.<fullwidth p>hp", "/shell.<circled php>" were all detected as
  ".php" files.

Replace the fallback with strict byte-level ASCII case-insensitive
matching: any byte >= utf8.RuneSelf in the path can never be part of a
match, since SplitPath entries are validated ASCII-only and lower-cased
in Provision(). This keeps the hot path branch-light and removes the
x/text/search dependency from the main module.

Reported against FrankenPHP as GHSA-3g8v-8r37-cgjm and
GHSA-v4h7-cj44-8fc8. The vulnerable function in this module was adapted
from the same FrankenPHP code.
2026-05-07 13:59:42 -06:00
Zen Dodd
d2172bea61 chore: Fix golangci-lint 2.12.1 findings (#7690) 2026-05-07 03:40:26 -04:00
Zen Dodd
c7c9f3108a caddyauth: Revert "set user placeholders before auth rejection (#7685)" (#7688)
This reverts commit 7e77eec0ae.
2026-05-05 09:12:46 -06:00
Rayan Salhab
7e77eec0ae caddyauth: set user placeholders before auth rejection (#7685)
* caddyauth: set user placeholders before auth rejection
* docs: update auth placeholder comment
2026-05-03 13:40:11 +10:00
Felix Eckhofer
ef496e58ef caddytls: Expand ACME credentials (#7554)
* caddytls: Expand ACME credentials

This allows using global placeholders such as {file./run/secrets/key_id}
when setting up the tls configuration.

* chore(formatting): gofmt on acmeissuer_test
2026-05-03 07:13:57 +10:00
Matt Holt
4d6945769d reverseproxy: Add ability to clear dynamic upstreams cache during retries (#7662)
* reverseproxy: Add ability to clear dynamic upstreams cache during retries

This is an optional interface for dynamic upstream modules to implement if they cache results.

TODO: More documentation; this is an experiment.

* Add some godoc

* Export interface; update godoc
2026-04-28 09:16:18 -06:00
Zen Dodd
fdbef2a6ef logging: add regression coverage for rotated file mode (#7620) 2026-04-26 23:30:44 +10:00
Kévin Dunglas
2a3ed96f8c metrics: Implement pushing via OLTP (#7664) 2026-04-25 06:52:08 -04:00
Francis Lavoie
eeb13f1ca8 More comments 2026-04-25 05:42:43 -04:00
Francis Lavoie
97f5fe0079 Rename to stream_detached 2026-04-25 05:38:37 -04:00
Francis Lavoie
558ec222db Add note about capturing h 2026-04-25 05:38:37 -04:00
Francis Lavoie
e3b1bf80f4 Rename to tunnelTracker, reflow some comments 2026-04-25 05:38:37 -04:00
Francis Lavoie
1b8d60c459 Move type and const down to the bottom 2026-04-25 05:38:37 -04:00
WeidiDeng
733aaba102 only clean up connections when stopped 2026-04-25 05:38:37 -04:00
WeidiDeng
ed44e4d3f6 change the log level if hijacking without writing a status code first 2026-04-25 05:38:37 -04:00
WeidiDeng
f970f397e2 fix tests 2026-04-25 05:38:37 -04:00
WeidiDeng
6ba6cf5d13 fix tests 2026-04-25 05:38:37 -04:00
WeidiDeng
ccc76ac1f6 make handleUpgradeTunnel a standalone func 2026-04-25 05:38:37 -04:00
WeidiDeng
cee04ab28e correctly close detached streams 2026-04-25 05:38:37 -04:00
WeidiDeng
e7055d85a4 simplify streaming handling 2026-04-25 05:38:37 -04:00
WeidiDeng
b9b12025c6 record bytes read and written for response writers unless detached 2026-04-25 05:38:37 -04:00
Francis Lavoie
7ef9ecd48a Adjustments from Weidi's review 2026-04-25 05:38:37 -04:00
Francis Lavoie
307dfd0431 Improved logging facilities 2026-04-25 05:38:37 -04:00
Francis Lavoie
daea7788ad lint 2026-04-25 05:38:37 -04:00
Francis Lavoie
b68e9bfdd4 reverseproxy: Optionally detach stream (websockets) from config lifecycle 2026-04-25 05:38:37 -04:00
Francis Lavoie
355c178213 chore: Use atomics where appropriate (#7648)
* chore: Use atomics where appropriate

* Use atomic for shutdownAt
2026-04-25 03:47:54 -04:00
Matt Holt
441d5eb062 caddyhttp: prefer port 443 in auto-HTTPS and add tests (#7666) 2026-04-23 17:29:03 +10:00
Daniil Sivak
aed1af5976 reverseproxy: add lb_retry_match condition on response status (#7569) 2026-04-21 14:59:31 -04:00
Zen Dodd
4430756d5c admin: Redact sensitive request headers in API logs (#7578)
* admin: Redact sensitive request headers in API logs

* Fix govulncheck and typed atomic lint failures

* Sync Go module metadata after dependency downgrade
2026-04-17 14:56:42 -06:00
Steffen Busch
24bebd0a07 caddyhttp: Document missing placeholders for escaped URI and prefixed query (#7659) 2026-04-17 16:13:15 -04:00
Max Truxa
7586e68e27 fileserver: show symlink targets verbatim (#7579)
`reveal_symlinks` was exposing symlink targets as fully resolved absolute paths, even if the target is a relative path. With this change the link target is shown as-is, without resolving anything.
2026-04-15 04:49:30 +10:00
Zen Dodd
0c7c91a447 logging: preserve ts for journald-wrapped JSON logs (#7644) 2026-04-13 17:33:02 -06:00
tsinglua
0722cf6fd8 chore: replace interface{} with any for modernization (#7571)
Signed-off-by: tsinglua <tsinglua@outlook.com>
2026-04-11 19:53:12 +03:00
Zen Dodd
5f44ea0748 logging: add journald encoder wrapper (#7623) 2026-04-10 17:09:12 -06:00
Zen Dodd
7dcc041eec vars: Add matcher placeholder handling tests (#7640)
* vars: add matcher placeholder handling tests

* vars: add query placeholder matcher coverage
2026-04-10 16:27:52 -06:00
Zen Dodd
ca0ca67fbd reverseproxy: make stream copy buffer size configurable (#7627) 2026-04-10 14:49:32 -06:00
vnxme
5de1565ff6 vars: Don't expand placeholders in values (#7629) 2026-04-10 09:37:43 -06:00
Harsh Patel
d7834676aa tls: add system and combined CA pool modules (#7406)
* feat: add system and combined CA pool modules

* fix: combining pools using `CertificateProvider`

* fix: lint issue

* chore: caddyfiletests
* doing it for first time, so not sure if its right.

* fix: use `x509` native addCert

* chore: explicit err handling

* Apply suggestion from @mohammed90

---------

Co-authored-by: Mohammed Al Sahaf <mohammed@caffeinatedwonders.com>
2026-04-06 01:13:34 +03:00
Pieter Berkel
4f50458866 tls: expand placeholders in dns_challenge override_domain (#7609) 2026-03-31 05:46:32 +00:00
yubiuser
ea4ee3ae5d reverseproxy: Fix check for header_up Host {upstream_hostport} redundancy (#7564)
* Fix check for header_up

Signed-off-by: yubiuser <github@yubiuser.dev>

* Onyl check in case commonScheme == "https"

Signed-off-by: yubiuser <github@yubiuser.dev>

* Move check after TLS transport is enabled

Signed-off-by: yubiuser <github@yubiuser.dev>

---------

Signed-off-by: yubiuser <github@yubiuser.dev>
2026-03-30 10:56:10 -06:00
Sam Ottenhoff
7a630f2910 encode: make zstd checksum configurable (#7586)
* http: make zstd checksum configurable

* disable_checksum
2026-03-28 13:07:21 -06:00
Marc
62e9c05264 root: introduce down-propagating Helper.BlockState for other directives/plugins to use (#7594)
* add 'root' key to Helper.State for access in frankenphp's `php_server` directive

* clone state before passing it to child directives, but keep sharing it among sibling directives

* propagate named route state from children to parent

* use BlockState to set "root" instead

* gofmt -w .

* go fmt ./...

* here we go
2026-03-28 17:44:42 +00:00