Test $HTTP["language"] for preferred language?
Lighttpd can use $HTTP["language"] to test the Accept-Language header, but one often wants to test which language is preferred among a set of languages: i.e., should I rather serve the English version, the French version, or the Quenya version? This is very inconvenient to do with a regexp, so maybe it would make sense to have a specific feature for that?
#1 Updated by gstrauss about 1 year ago
It sounds like you are asking for implementation of an entirely new module in lighttpd, similar to mod_negotiation in Apache https://httpd.apache.org/docs/current/en/mod/mod_negotiation.html or nginx try_files (more limited)
You are correct that there is currently no such feature in lighttpd. Patches welcome, though this involves writing an new module, so supporting this is not a trivial code change.
In the meantime, you can perform the content negotiation yourself in a CGI, FastCGI, or SCGI script. Yes, this can be slightly slower than doing it natively in lighttpd, but not much slower if you use FastCGI or SCGI and the response from the script sends lighttpd a special X-Sendfile response header.
#3 Updated by gstrauss about 1 year ago
Here's a blog post made earlier this year which includes a script for use with nginx. I haven't looked closely at it for accuracy. http://www.guido-flohr.net/simple-content-negotiation-for-nginx/
sample lua code which (minimally) processes Accept-Encoding was contributed in #2678 by darix: https://gist.github.com/darix/5025010490bb0ea70099
It might be a decent base if you wanted to modify the lua to process Accept-Language and then try files with different extensions for languages in order to serve a file of the preferred language
Also available in: Atom