Static multilanguage blog with multilanguage error pages

Hello, all!

I try to run static multilanguage blog with Caddy and now have setup like this:

:4000
gzip
root /app/public

prometheus :9180

errors {
    404 /en/404.html
    500 /en/500.html
}

Static files arranges as follows:

# ls -1 ru/
10-otbornyh-kanalov-v-telegrame-dlya-marketologov-i-ne-tolko
404.html
5-sposobov-ekonomit-vremya-v-rabote-s-sotssetyami
500.html
...

# ls -1 en/
404.html
500.html
how-to-product-hunt-for-international-products-part-1
...

And so on.

The question is:
Is there any way to route error pages based on language tag in URL?
E.g. show /en/404.html for URL like /en/no-such-url-here, show /ru/404.html for nonexistent URLs started with /ru and so on.

Thanks in advance!

The errors directive does not have rewrite capabilities; but you can use rewrite to show an error page if a file does not exist; see the to subdirective. https://caddyserver.com/docs/rewrite

Thanks, @matt.
Will try use rewrite.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.