How to check header

Hi guys!
how to check content-length header length if it is less than 2 and more than 10 show error 403 using caddy 1 version

Welcome Alex from the EU! :slight_smile:

I am not sure if it is possible in Caddy 1. In Caddy 2, this is almost possible but I don’t know if we have a way to perform numerical comparisons of header values yet. Can you file an issue on GitHub to request this specific feature? Right now we’re really resource constrained so it might be a while unless the community creates a proposal and implements it. https://github.com/caddyserver/caddy/issues/new

Is this something Caddy v2 could do with Starlark? I have no idea how Starlark scripting works yet, never tried it out and it doesn’t really seem to be documented yet.

Yeah, but we postponed development of Starlark stuff until there’s a commercial interest for it since my time is extremely limited right now.

It could also be done without Starlark if we want to add some JSON that allows you to define a different route (a set of HTTP handlers) to evaluate based on a response. I think that’s ultimately the feature being requested here: record a response, then conditionally evaluate a different route based on properties of the response. It’s not a small feature, so it would take a little time to get right. But it’s also not too difficult.