Is there an easier way to accomplish what I’m trying to accomplish here. I need /cloud and /cloud/* to match and /infocus /infocus/* to match similar to a location in nginx. I could put two handlers in there I guess or regex. I’m not sure handlers are appropriate in this situation but it seemed to fit the bill.
Also your strip_prefix is probably incorrect, I’m pretty sure it should be /infocus rather than infocus/. There was a time during the betas where that would work, but not anymore.
The infocus rewrite looks unnecessary to me because you already have strip_prefix. Are you doing that because it’s case sensitive? If so, then
You can also remove the to line and move the upstream right between reverse_proxy and {.
And finally, you can skip passing X-Forwarded-For and X-Forwarded-Proto, those are done for you by Caddy!
I am doing that due to case sensitivity, the infocus/ seems to work, don’t remember why I did that, I think I ended up with duplicate / on the end somewhere which I could have accounted for in that spot or done this here, but I’ll look at that again.
It’s important to not that this is not the same behaviour as matching both /cloud and /cloud/. This is effectively pretending that a request for /cloud is actually a request for /cloud/, so if your client or upstream expect there to be a difference between the two requests, this example is unsuitable.
Assuming they don’t expect a difference between the two, I like this because it’s a bit neater and doesn’t need a named matcher.