Document middleware order

For debugging uses especially considering the increasing 3rd party middlewares coming with the new site it might make sense to be able to query the used order for middlewares. The first idea was to just document this on side, but it might make more sense to add a cli command to provide this info.

@matt as suggested to continue here.

The order in which directives are executed (and thus their middlewares) is hard-coded: https://github.com/mholt/caddy/blob/06873175bf9141531e5de2e6b061f2ba94014edc/caddyhttp/httpserver/plugin.go#L418

Just to clarify, is that what you want documented?

Hardcoded for the currently available. Won’t this part be customized on custom downloads? Or does all 3rd party plugins need to be “approved” via a PR to the hard coded directives list first?

Yes, one final problem I need to work out is that directives for new HTTP server plugins will have to go into this list somehow; and new plugins will have to be published when the next version of Caddy is released that has their directive listed.

Either way I think it should be documented, if all plugins need to be added to the hardcoded list anyway. This could fine from a docs perspective, when linked from the FAQ. If the list actually will be custom due to the new build infra, this should be available somewhere during download or as said better within the binary as a cli command.

Would a link from one of the docs pages to the appropriate source file on Github suffice, do you think? Would be easier than having to keep both updated.

1 Like

A link would be fine, but I still think as a debugging command it makes more sense to just print the order of this speicifc binary with a command like: “caddy -h --middleware” or something to show additional info about the middleware order and middlewares used or maybe just add it as additional output for -h.

1 Like