The caddyfile below has been working for a year or more now. Last week I updated Caddy for the first time in about a year (from 0.10.11 to 0.11.2), and now I have a problem. It seems to me that the rewrite line is now rewriting everything instead of just an empty request.
Has something changed, or is there an issue?
The commented out rewrite was my attempt to work round it, but it cause a hang.
As far as I can remember, / has always been the default base path, and it’s effectively catch-all.
If you want to rewrite only when the path is exactly/, you can test for that:
rewrite {
if {path} is /
to /magnoliaPublic/ai/index.html
}
I expect instead of pattern in your workaround, you’d want regexp instead; possibly that was the cause of the hang, but you don’t need to pattern match anyway, it’s just an unnecessary expense computationally when you can just compare to {path}.
I would classify it as a bug in the code, unless an explicit decision has been made to change behaviour which has formerly been decided upon and documented, and may have been used by others.
At the least, if a change of behaviour is decided on (which I could understand), it should be documented as a change in the release notes (indeed, I looked there before reporting this).