474 Commits

Author SHA1 Message Date
prettysunflower
2dd3852416 fix(caddyfile): Prevent parser to panic when no token were added by empty {block} (#7543) 2026-03-03 13:16:21 -05:00
Pavel Siomachkin
f145bce553 tls: Add tls_resolvers global option for DNS challenge configuration (#7297)
Co-authored-by: Francis Lavoie <lavofr@gmail.com>
2026-03-01 15:32:04 -05:00
Oleksandr Redko
72eaf2583a chore: Enable modernize linter (#7519) 2026-02-26 14:01:35 -07:00
Paulo Henrique
7ffb640a4d httpcaddyfile: Fix missing TLS connection policies when auto_https is default (#7325) (#7507) 2026-02-21 21:42:03 -05:00
Matt Holt
95941a71e8 chore: Add nolints to work around haywire linters (#7493)
* chore: Add nolints to work around haywire linters

* More lint wrangling
2026-02-17 16:52:54 -07:00
Francis Lavoie
d64c7e67a4 caddyhttp: Option to disable 0-RTT (#7485) 2026-02-16 10:20:47 -07:00
Amirhf
affbb99275 pki: add per-CA configurable maintenance_interval and renewal_window_ratio (#7479)
* pki: add per-CA configurable maintenance_interval and renewal_window_ratio

- Add MaintenanceInterval and RenewalWindowRatio to CA struct (JSON + Caddyfile).
- Run one maintenance goroutine per CA using its own interval.
- needsRenewal uses per-CA RenewalWindowRatio; invalid/zero ratio falls back to defaults.
- Caddyfile: maintenance_interval duration, renewal_window_ratio <0-1>.
- Tests: TestCA_needsRenewal, TestParsePKIApp for new options.

Fixes #7475

* fix codestyle
2026-02-15 09:10:12 -05:00
Aditya Bhargava
d6a6b486db httpcaddyfile: Override global dns with acme_dns (fix #7294) (#7458)
This brings the behaviour in line with what the documentation implies.
2026-02-15 09:04:59 +00:00
mehrdadbn9
929d0e502a caddyfile: Add renewal_window_ratio global option and tls subdirective (#7473)
* caddyfile: Add renewal_window_ratio global option

Adds support for configuring the TLS certificate renewal window ratio
directly in the Caddyfile global options block. This allows users to
customize when certificates should be renewed without needing to use
JSON configuration.

Example usage:
    {
        renewal_window_ratio 0.1666
    }

Fixes #7467

* caddyfile: Add renewal_window_ratio to tls directive and tests

Adds support for renewal_window_ratio in the tls directive (not just
global options) and adds caddyfile adapt tests for both the global
option and tls directive.

* fix: inherit global renewal_window_ratio in site policies

* fix: correct test expected output for policy consolidation

* fix: properly inherit global renewal_window_ratio without removing other code
2026-02-13 16:47:02 -05:00
Matthew Holt
6718bd470f caddytls: Finish removing prefer_wildcard
Finish what should have been done a year ago in #6959)
2026-02-12 11:35:28 -07:00
Francis Lavoie
d269405eab core: Show JSON error offsets where possible (#7437) 2026-01-14 22:54:19 -05:00
Mohammed Al Sahaf
e40bd019ff caddyfile: add observe_catchall_hosts option (#7434)
* caddyfile: add `observe_catchall_hosts` option

Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com>

* correct JSON field name and doc comment

Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com>

---------

Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com>
2026-01-14 00:06:16 +00:00
Paulo Henrique
e9d290de2f caddyconfig: Fix indentation of multiline strings in fmt (#7425) (#7433) 2026-01-13 15:22:23 -05:00
Francis Lavoie
90972fbebc chore: Dumb prealloc lint fix (#7430) 2026-01-13 14:13:43 -05:00
vnxme
31960dc998 Introduce packet conn wrappers (#7180)
* packet_conn_wrappers: Initial changes

* packet_conn_wrappers: Unwrap a packet conn only if there are no wrappers

---------

Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
2025-12-04 14:15:56 -07:00
Ted
92c8bc7322 caddyfile: fix nested quotes formatted incorrectly by fmt (#7045)
* Fix incorrectly formatted quote within quotes with fmt

* Fix incorrectly formatted quote within quotes with fmt
2025-10-27 16:13:47 -06:00
Chris Seufert
d7185fd002 caddyhttp: Add trusted_proxies_unix for trusting unix socket X-Forwarded-* headers (#7265) 2025-10-16 02:47:32 +00:00
wyrapeseed
d115cd1042 chore: fix some comments (#7303) 2025-10-15 03:58:53 +00:00
joshuamcbeth
de6b78009b caddyhttp: Add server options keepalive_idle and keepalive_count (#7298)
* Add Server options KeepAliveIdle (keepalive_idle) and KeepAliveCount (keepalive_count)

Signed-off-by: Joshua McBeth <joshua.mcbeth@gmail.com>

* Add Server option KeepAliveDisable (keepalive_disable)

Signed-off-by: Joshua McBeth <joshua.mcbeth@gmail.com>

* Remove Server option KeepAliveDisable (keepalive_disable), disable when interval is negative

Signed-off-by: Joshua McBeth <joshua.mcbeth@gmail.com>

* Add keepalive parameters to caddyfiletest

Signed-off-by: Joshua McBeth <joshua.mcbeth@gmail.com>

---------

Signed-off-by: Joshua McBeth <joshua.mcbeth@gmail.com>
2025-10-14 12:03:23 -06:00
Monviech
2f1d270968 httpcaddyfile: Map default_bind to BindHost in globalACMEDefaults (#7278)
* Implement BindHost fallback in ACME issuer

* Fix indentation

* Skip creating empty challenges stub in adapted json config

* Skip setting BindHost for DNS Challenge

* golangci-lint fix

---------

Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
2025-10-06 16:48:38 -06:00
Aditya Bhargava
3c003deec6 httpcaddyfile: Add missing DNS challenge check for acme_dns (#7270)
* add optional argument to `mock` DNS provider

* preserve local DNS challenge settings when `acme_dns` is specified

* add missing check for `acme_dns`
2025-10-03 14:05:46 -06:00
Francis Lavoie
65e0ddc221 core: Reloading with SIGUSR1 if config never changed via admin (#7258) 2025-09-26 16:50:15 +00:00
Artur H.
0ba8786b35 caddyfile: Allow block to do nothing if nothing passed to import (#7206) 2025-09-12 20:29:09 +00:00
Pavel
d9cc24f3df caddypki: Disable internal auto-CA when auto_https is disabled (fix #7211) (#7238)
Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
2025-09-05 09:41:06 -06:00
Arpan Saha
6d73d85c1f caddyfile: prevent adding trailing space on line before env variable (#7215) 2025-08-26 15:13:54 -06:00
Bang Lee
5e2953670e caddyhttp: add replacer placeholders for escaped values (#7181) 2025-08-25 09:07:51 -06:00
Artur H.
551f793700 caddyfile: Fix importing nested tokens for {block} (#7189) 2025-08-22 21:29:34 +00:00
Francis Lavoie
4564261d83 httpcaddyfile: Fix acme_dns regression (#7199) 2025-08-22 15:09:25 -06:00
Matthew Holt
42c888ee1d Ignore irrelevant linter warning 2025-08-04 16:28:13 -06:00
Matthew Holt
0badb071ef httpcaddyfile: Fix generated config related to ACME global options
If global DNS provider is configured, it does not need to be repeated in the JSON.

If acme_* options are used, base automation policies should populate their issuers accordingly.

Global issuer settings like acme_* options don't need to specify subjects in the automation policy since they should apply as a global default.
2025-08-04 16:22:25 -06:00
Matthew Holt
5b727bde29 httpcaddyfile: Allow naked acme_dns if dns is set (fix #7091) 2025-07-29 11:56:09 -06:00
Francis Lavoie
77dd12cc78 httpcaddyfile: Validates TLS DNS challenge options (#7099)
* httpcaddyfile: Validates TLS DNS challenge options

Adds validation to the TLS Caddyfile adapter to ensure that when DNS challenge options (such as propagation_delay or dns_ttl) are specified, a DNS provider is also configured.

Adds new integration tests to verify this validation logic, and implements a new mechanism for adapt tests to assert a config adapt error.

* Add some more AI-generated tests asserting config errors

* Parallel doesn't work here, we use global variables

* Windows fix
2025-06-30 23:58:16 +00:00
Hina🐣 | Developer
0f209f62eb httpcaddyfile: reject blocks in log_skip directive (#7056) 2025-06-09 21:56:21 -06:00
Youness Farini
092913a7a5 httpcaddyfile: Prevent error handler from overriding sub-handler matchers (#6999)
Fixes: #6957
2025-06-06 11:46:39 -06:00
Mohammed Al Sahaf
e039a5bb5c chore: upgrade .golangci.yml and workflow to v2 (#6924)
* chore: upgrade .golangci.yml and workflow to v2

run `golangci-lint fmt`

Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com>

* run `golangci-lint run --fix`

Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com>

* more lint fixes

Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com>

* bring back comments to .golangci.yml

Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com>

* appease the linter some more

Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com>

* oops

Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com>

* use embedded structs

Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com>

* use embedded structs where they were used before

Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com>

* disable rule  `-QF1006`

Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com>

* missed a spot

Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com>

---------

Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com>
2025-06-03 02:24:32 +03:00
eveneast
a76d005a94 Use maps.Copy for simpler map handling (#7009)
Signed-off-by: eveneast <qcqs@foxmail.com>
2025-05-13 15:16:47 -06:00
WeidiDeng
8524386737 caddyhttp: Compare paths w/o wildcard if prefixes differ (#7015)
* fix route sort by comparing paths without wildcard if they don't share the same prefix

* sort lexically if paths have the same length
2025-05-13 13:17:52 -06:00
Matt Holt
1bfa111552 caddytls: Prefer managed wildcard certs over individual subdomain certs (#6959)
* caddytls: Prefer managed wildcard certs over individual subdomain certs

* Repurpose force_automate as no_wildcard

* Fix a couple bugs

* Restore force_automate and use automate loader as wildcard override
2025-04-18 11:44:23 -06:00
Matthew Holt
8dc76676fb chore: Modernize a couple for loops 2025-03-19 09:53:42 -06:00
Ted
b3e692ed09 caddyfile: Fix formatting for backquote wrapped braces (#6903) 2025-03-17 08:58:46 -06:00
Steffen Busch
f4432a306a caddyfile: add error handling for unrecognized subdirective/options in various modules (#6884) 2025-03-08 23:45:05 +03:00
Matthew Holt
1975408d89 chore: Remove unnecessary explicit type parameters 2025-03-07 11:18:00 -07:00
Matthew Holt
bc3d497739 caddytls: Fix broken refactor
Not sure how that happened...
2025-03-06 08:54:40 -07:00
Matt Holt
d7764dfdbb caddytls: Encrypted ClientHello (ECH) (#6862)
* caddytls: Initial commit of Encrypted ClientHello (ECH)

* WIP Caddyfile

* Fill out Caddyfile support

* Enhance godoc comments

* Augment, don't overwrite, HTTPS records

* WIP

* WIP: publication history

* Fix republication logic

* Apply global DNS module to ACME challenges

This allows DNS challenges to be enabled without locally-configured DNS modules

* Ignore false positive from prealloc linter

* ci: Use only latest Go version (1.24 currently)

We no longer support older Go versions, for security benefits.

* Remove old commented code

Static ECH keys for now

* Implement SendAsRetry
2025-03-05 17:04:10 -07:00
Mohammed Al Sahaf
f2c17d1f3f testing: sort force-automated hosts (#6756) 2024-12-30 05:38:29 -05:00
Francis Lavoie
afa778ae05 httpcaddyfile: Implement experimental force_automate option (#6712) 2024-12-24 08:58:40 -07:00
Matthew Holt
ed1c594cdb go.mod: Upgrade ACMEz to v3; and upgrade CertMagic 2024-12-19 12:17:07 -07:00
José Padilla
57ae9c3107 chore: fix some typo in HTTPLoader comment (#6735) 2024-12-07 11:30:20 +00:00
Francis Lavoie
b116dcea3d caddyhttp: Add {?query} placeholder (#6714)
* caddyhttp: Add `{prefixed_query}` placeholder

* fastcgi: Preserve query during canonical redirect

* Use orig_uri instead for the redirect, shorter Caddyfile shortcut
2024-12-02 08:06:38 -05:00
Francis Lavoie
315715e90f core: Implement FastAbs to avoid repeated os.Getwd calls (#6687)
* core: Implement FastAbs to avoid repeated os.Getwd calls

* Lint

* Rename files
2024-11-13 03:55:51 -05:00