https://redmine.lighttpd.net/https://redmine.lighttpd.net/favicon.ico?13667327412016-07-18T15:55:32Zlighty labsLighttpd - Feature #2736: Test $HTTP["language"] for preferred language?https://redmine.lighttpd.net/issues/2736?journal_id=103252016-07-18T15:55:32Zgstrauss
<ul></ul><p>It sounds like you are asking for implementation of an entirely new module in lighttpd, similar to mod_negotiation in Apache <a class="external" href="https://httpd.apache.org/docs/current/en/mod/mod_negotiation.html">https://httpd.apache.org/docs/current/en/mod/mod_negotiation.html</a> or nginx try_files (more limited)</p>
<p>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.</p>
<p>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.</p> Lighttpd - Feature #2736: Test $HTTP["language"] for preferred language?https://redmine.lighttpd.net/issues/2736?journal_id=103262016-07-18T15:59:15Za3nm
<ul></ul><p>Apropos patches, it's unlikely I will have the time to write such a module myself. I just wanted to make a suggestion.</p>
<p>In any case, thanks a lot for confirming that this does not exist, clarifying the situation, and even proposing a workaround!</p> Lighttpd - Feature #2736: Test $HTTP["language"] for preferred language?https://redmine.lighttpd.net/issues/2736?journal_id=103272016-07-18T16:02:30Zgstrauss
<ul></ul><p>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. <a class="external" href="http://www.guido-flohr.net/simple-content-negotiation-for-nginx/">http://www.guido-flohr.net/simple-content-negotiation-for-nginx/</a></p> Lighttpd - Feature #2736: Test $HTTP["language"] for preferred language?https://redmine.lighttpd.net/issues/2736?journal_id=103282016-07-18T16:14:02Zgstrauss
<ul></ul><p>You can also do this in lighttpd today with mod_magnet and a snippet of custom lua code. I wonder if someone has already done this. I suggest looking around with your favorite search engine.</p> Lighttpd - Feature #2736: Test $HTTP["language"] for preferred language?https://redmine.lighttpd.net/issues/2736?journal_id=108012017-01-22T11:08:02Zgstrauss
<ul></ul><p>sample lua code which (minimally) processes Accept-Encoding was contributed in <a class="issue tracker-2 status-5 priority-3 priority-lowest closed" title="Feature: New mod_precompress feature (Fixed)" href="https://redmine.lighttpd.net/issues/2678">#2678</a> by darix: <a class="external" href="https://gist.github.com/darix/5025010490bb0ea70099">https://gist.github.com/darix/5025010490bb0ea70099</a></p>
<p>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</p> Lighttpd - Feature #2736: Test $HTTP["language"] for preferred language?https://redmine.lighttpd.net/issues/2736?journal_id=108532017-02-14T05:17:23Zgstrauss
<ul><li><strong>Related to</strong> <i><a class="issue tracker-2 status-5 priority-3 priority-lowest closed" href="/issues/2678">Feature #2678</a>: New mod_precompress feature</i> added</li></ul> Lighttpd - Feature #2736: Test $HTTP["language"] for preferred language?https://redmine.lighttpd.net/issues/2736?journal_id=108552017-02-14T05:19:06Zgstrauss
<ul><li><strong>Category</strong> changed from <i>core</i> to <i>mod_magnet</i></li><li><strong>Target version</strong> changed from <i>1.4.x</i> to <i>1.4.46</i></li></ul><p>This is achievable using some custom lua code with lighttpd mod_magnet</p>
<p>See attachment to <a class="issue tracker-2 status-5 priority-3 priority-lowest closed" title="Feature: New mod_precompress feature (Fixed)" href="https://redmine.lighttpd.net/issues/2678">#2678</a></p> Lighttpd - Feature #2736: Test $HTTP["language"] for preferred language?https://redmine.lighttpd.net/issues/2736?journal_id=108572017-02-14T06:23:05Zgstrauss
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Fixed</i></li></ul><p>Attached content-negotiation.lua to <a class="issue tracker-2 status-5 priority-3 priority-lowest closed" title="Feature: New mod_precompress feature (Fixed)" href="https://redmine.lighttpd.net/issues/2678">#2678</a> with code to handle Accept-Language and Accept-Encoding. Lightly tested. YMMV.<br /><pre>
server.modules += ( "mod_magnet" )
magnet.attract-physical-path-to = ( "/path/to/content-negotiation.lua" )
</pre></p>