Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/simia-tech/caddy-locale

Locale detection for caddy
https://github.com/simia-tech/caddy-locale

Last synced: about 2 months ago
JSON representation

Locale detection for caddy

Awesome Lists containing this project

README

        

# Locale detection for caddy

## Configuration schema

locale {
detect
cookie
available
path
}

A `method` can be currently `cookie` or `header`. If `cookie` is added, `cookie name` defines from which cookie the
locale is read. The `header` method extracts the locales from the `Accept-Language` header. The first `availableLocale`
is also the default locale, which is picked if none of the locales from the detection methods is in `availableLocales`.

The defaults are: `methods = [header]`, `cookie name = locale`, `path scope = /`.

## Example

locale en de {
detect cookie header
}

rewrite {
ext /
to index.{>Detected-Locale}.html index.html
}

header / Vary "Cookie, Accept-Language"