trying out caddy, I am happy to have found a Go product which fits most of our needs.
Just one thing so far which I could not figure out:
I need localized “404 Not found” pages, so “/en/some/path/not/existing” should diplsay /en/not_found.html", whereas “/fr/some/path/not/existing” should diplsay /fr/not_found.html".
In one issue responds, use of “rewrite” is suggested, but I dont get it. How can I rewrite non existing paths?
The errors directive doesn’t have a method to specify locale-specific error pages, and as you noted it is a bit difficult to rewrite a nonexistent path - but that doesn’t mean it can’t be done.
Since your locales appear to be prepended to the URI, you can use multiple site definitions to achieve what you want. Try something like this example:
I don’t think there’s any reason the errors directive couldn’t be altered in this way.
Could you jump over to https://github.com/mholt/caddy/issues and open an issue for this feature request? Let us know if there’s any specifics you’d like to see, and the contributors can discuss possible implementation.