1

for nginx there's a very nice module available to filter a response and search/replace content in it: http://wiki.nginx.org/HttpSubModule

i wonder, if there's a similar possibility for lighttpd available?

thanks in advance,

Martin Fjordvald
  • 7,749
  • 1
  • 30
  • 35
harald
  • 403
  • 2
  • 6
  • 19

2 Answers2

1

Current 1.4.x release default modules seem to miss that functionality but as far as this page goes it could be supported in some future 1.5.x release i na module named mod_layout.

lapo
  • 311
  • 3
  • 8
  • mod_layout seems to be exactly what i am looking for. but is 1.5 already "usable"? normally i don't have a problem using beta-quality software, but it should be somehow stable that i am able to deploy it in a live environment without having to restart it over and over again ;) – harald Jan 26 '11 at 12:14
  • lighttpd 1.5.x branch has been abandoned. Some solutions are possible using lighttpd [mod_magnet](https://wiki.lighttpd.net/mod_magnet). See answer below. – gstrauss Jun 12 '23 at 21:12
0

Take a look at AbsoLUAtion examples. lighttpd with mod_magnet and Lua scripting can do all kind of complex content modifications.

Janne Pikkarainen
  • 31,852
  • 4
  • 58
  • 81
  • yes, mod_magnet is very cool -- i am already using it for several complex rewriting / redirection stuff. but as far as i know it can only handle a request but not the response. – harald Jan 26 '11 at 12:11
  • harald: That's why I pointed you out the AbsoLUAtion examples. Take a look at code snippets there, such as "Sending text files as HTML" or "Selecting a random file from a directory", which both modify the content. Would those examples lead you to right direction? – Janne Pikkarainen Jan 26 '11 at 12:16
  • the problem is, that i have to replace some content in the response of a web application running using fastCGI. all i can find in the examples is about header-manipulation and static content loading. – harald Jan 26 '11 at 12:23
  • lighttpd mod_magnet in lighttpd 1.4.56 and later support `magnet.attract-response-start-to` where you can rewrite the response IFF lighttpd is configured for response offloading (the default) which collects the response from the backend before sending it to the client (instead of being configured to stream the response to the client as the response is produced from the backend). – gstrauss Jun 12 '23 at 21:09