Iām attempting to use a {user} placeholder in a rewrite. In prior versions on caddy, I built caddy and reordered the basicauth directive before the rewrite to make this work correctly. In v2, I believe there is a āglobalā section that iāve tried in my config to reorder the directives which I though would achieve teh same thing. I havenāt been able to get this to work but honestly Iām not sure if my syntax is even completely right since v2 is very different.
So the underlying question here is: Does the global reordering i do in the first set of lines of my config suposed to achieve what iām trying to accomplish?
4. Error messages and/or full log output:
Not particularly relevant I donāt think.
5. What I already tried:
Iāve tried to use the globals to reorder. Iāve verified by rewrite block works by using other criteria and I get 403s correctly. Iāve verified my expression itself is fine by adding this āexpression āmonitorā == āmonitorāā instead of the placeholder as a test
The placeholder youāre looking for is actually {http.auth.user.id}
Also, your Caddyfile looks incomplete, youāre missing a site label. Please donāt omit parts of your config, it only makes it harder for us to help.
Ah. That worked. May I ask how you determined that was the placeholder? Is there a way I could have determined that myself for future placeholders? I saw many are included in the docs but some arenāt. Thanks.
I went digging through the code to find it - unfortunately Iām not spotting it in the docs right now. Iāll make sure itās added. Sorry for the inconvenience!
I think your re-ordering of directives might not be necessary here - try without it as well to see if it does what you need!
Iām glad to see more people using the CEL expression matcher. The more use it gets, the quicker we can improve it and make it non-experimental!
Its pretty powerful. As feedback, iād really like to see more examples in the docs. I found it very difficult to formulate what I really want to do. I can create a new topic for that but for hte docs it would be very helpful to have a pretty good size list of examples to grow from.
The tricky part about documenting CEL expressions is we donāt necessarily want to maintain documentation for how the spec works because itās an external lib. We need to make sure to limit ourselves to just the parts that are relevant to Caddy. The CEL spec is available here: