Question: Do you like how your current mapping configuration works, or would you like anything changed about it? i.e. if you could have it ANY WAY YOU WANT with your web server, how would it be? Just like it is now?
One thing to consider: do you pre-generate this config and then reload it when any of those half-million-lines change, as a stopgap for a static config? (In other words, are you using this huge static config in place of a dynamic config?) Would you rather this mapping be dynamic? If so, how would you like it to work?
But if all things are to stay the same, this will be very straightforward and I can have this done by the end of the week.
Well as the map implementation looks quite fast it would be okay for me to have it as it is in nginx. We pre-generate the map file and run a nginx reload as there is no service interruption at reload time.
Cool, Iām working on this today. Iām going to first implement the map module with similar functionality so that you can keep your existing processes and so other users can migrate more easily. But Iām still interested in doing the mapping ābetterā in v2, since making your web server config a read-only database seems like a bit of a hack around lack of dynamic logic.
Yes, I agree ā but what specifically would work best with your setup?
In summary the map directive can be used to check some http-header, methodes and a lot more and set the variable to the defined value.
In the original use case we change the root line dynamically like this root /web/data/data$storageid; . Is this possible in Caddyserver v1 or v2 to change the root dynamically as I havenāt seen it in the doc if itās possible or not https://caddyserver.com/docs/root ?
The nice part with the map and nginx is that the variables and directives are evaluated at request time is this also possible in Caddyserver v1 or v2?
Iām not sure I follow as to why the map is more generic, what do you mean? The structure I proposed also sets variables which can be used in other places. (Thatās why I intended with "map_vars" - did you see that?)
Yeah, so can this.
Yes, in Caddy 2 the root is dynamic: Home Ā· caddyserver/caddy Wiki Ā· GitHub - it doesnāt say so explicitly right there, but you can customize it per-request with the matcher, and use placeholders (variables) in the root path itself.
Okay thanks for your patience. I have now created the config below. Is this something it can work with caddy v2? I have a json parser error but canāt see where the problem is.
I tried to build caddy v2 today and get the following error, sadly therfore I canāt test the config. It would be nice to have a working example config somewhere
Weāre still in the very early stages of documentation (obviously, as Caddy 2 is still pre-beta!) but there are multiple pages of docs for v2 on the wiki: Home Ā· caddyserver/caddy Wiki Ā· GitHub
One of the docs pages shows you how to build a HTTP server config from scratch: Home Ā· caddyserver/caddy Wiki Ā· GitHub - you can use that as a starting point.
Soon, yeah! Itās going to take a backseat to fastcgi at this point (which is my next big project starting monday), but Iāll get to work on it sooner or later, or when I have a few minutes here and there.
As we talk about features is/will this use case be possible?
I mean the cascading the matches. Maybe you can show us how to translate the conf snipplets below to caddy config
The most commands are quite straight forward, IMHO.