Note: As English is not my native language, I used an LLM (Large Language Model) to help format and polish this issues description. The actual issue discovery and technical content are my own work.
Description
The documentation for the forwardproxy plugin in Caddy provides an incorrect example for the dial_timeout directive. The example shows:
forward_proxy {
dial_timeout 30
}
This configuration fails with the error:
Error: adapting config using caddyfile: parsing caddyfile tokens for 'forward_proxy': wrong argument count or unexpected line ending after '30'
The issue occurs because dial_timeout requires a duration unit (e.g., s for seconds), as the caddy.ParseDuration function expects a string with a unit. The correct configuration should be, for example, dial_timeout 30s. The documentation does not reflect this requirement, leading to user confusion.
Steps to Reproduce
- Use the documented example in a Caddyfile:
:8080 {
forward_proxy {
dial_timeout 30
}
}
- Run Caddy with this configuration.
- Observe the error:
wrong argument count or unexpected line ending after '30'.
Expected Behavior
- The documentation should provide a correct example, such as
dial_timeout 30s, and note that a duration unit is required.
- The configuration
dial_timeout 30s should work without errors.
Actual Behavior
- The documented example
dial_timeout 30 is incorrect and causes a parsing error.
- The documentation does not clarify the need for a duration unit.
Suggested Fix
- Update Documentation: Correct the example in the
forwardproxy plugin documentation to use dial_timeout 30s and add a note that a duration unit (e.g., s, ms) is required.
- Example Revision: Replace the incorrect example with:
forward_proxy {
dial_timeout 30s
}
Environment
- Caddy Version: v2.10.0
- Plugin:
forwardproxy
- Operating System: macOS 13.7.6 (Intel chip)
Additional Context
The caddy.ParseDuration function, used to parse dial_timeout, requires a string with a duration unit, as seen in the Caddy source code. The incorrect example in the documentation misleads users, and a simple correction would improve clarity.
Description
The documentation for the
forwardproxyplugin in Caddy provides an incorrect example for thedial_timeoutdirective. The example shows:This configuration fails with the error:
The issue occurs because
dial_timeoutrequires a duration unit (e.g.,sfor seconds), as thecaddy.ParseDurationfunction expects a string with a unit. The correct configuration should be, for example,dial_timeout 30s. The documentation does not reflect this requirement, leading to user confusion.Steps to Reproduce
wrong argument count or unexpected line ending after '30'.Expected Behavior
dial_timeout 30s, and note that a duration unit is required.dial_timeout 30sshould work without errors.Actual Behavior
dial_timeout 30is incorrect and causes a parsing error.Suggested Fix
forwardproxyplugin documentation to usedial_timeout 30sand add a note that a duration unit (e.g.,s,ms) is required.Environment
forwardproxyAdditional Context
The
caddy.ParseDurationfunction, used to parsedial_timeout, requires a string with a duration unit, as seen in the Caddy source code. The incorrect example in the documentation misleads users, and a simple correction would improve clarity.