Caddy file has var syntax?

Can i set variable like
set some request->some_param
and use $some in other directives
like jwt, proxy, rewrite?


Hi Dave - nope, no variables in the Caddyfile. But you can set an environment variable and use that. See The Caddyfile — Caddy Documentation for more info.

It just ok. But i want build my own algo to redirect users and balancing requests - with env vars or others config wich can use right now - it’s not possible.

That’s cool, but I recommend a programming language (like Go) for that kind of task. :slight_smile:

If i can learn GO (in future it be possible) I would not be writing on this community.

Thanks. Functional vars-programming must have for better scalability and flexibility of configuration CaddyServer

It’s my opinion. Sorry for that.

Thanks Dave! Your opinion is valid, I’m not dismissing it. If you can learn to program a webserver-specific DSL with variables and memory and conditions, you can learn to program Go; it’s similar in difficulty but much more powerful.

Caddyfile is not meant to be programmable.

Ok. Can u Give me the direction in which I can make this programmed file. I want to use CaddyServer in order to solve my problem and I really like Caddy file (has ownage diff with nginx), I would not want to make their functionality separately. Is it possible to extend both the functionality of Caddy without dropping to the deep code fixes on the GO?

P.S. Sorry for bad english. I hope you understand me.

Well it depends what you’re trying to do! is a good place to start learning Go, and the Caddy wiki has instructions on how to extend Caddy. Hope that helps!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.