Skip to content

Incorrect dial_timeout Example in forwardproxy Documentation #170

@PrintNow

Description

@PrintNow

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

  1. Use the documented example in a Caddyfile:
    :8080 {
        forward_proxy {
            dial_timeout 30
        }
    }
  2. Run Caddy with this configuration.
  3. 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

  1. 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.
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions