Feature #1749
closedMake lighty.request fully writable in mod_magnet
Description
Without this patch changes in lighty.request table don't go outside of mod_magnet.
Test case:
revproxy.lua:
lighty.request["Host"] = lighty.request["X-Forwarded-Host"]
index.cgi:
#! /usr/bin/perl print "Content-Type: text/plain\n\n"; for (keys %ENV) { print $_, " => ", $ENV{$_}, "\n"; }
GET -H 'X-Forwarded-Host: www.example.com' !http://172.30.0.65/cgi/index.cgi
Request result (without patch):
HTTP_HOST => 172.30.0.65
Request result (with patch):
HTTP_HOST => www.example.com
This patch is really useful (together with mod_extforward) for lighttpd servers behind reverse proxy. In this scenario proxy adds special header (ex. X-Forwarded-Host:) with original Host: value and forwards requests to lighttpd.
Some CGI applications that depends on "correct" Host: header can work without modifications.
-- kupson
Files
Updated by stbuehler over 16 years ago
I am not convinced yet that it should be writable from mod_magnet; for example you ignore the fact that the hostname is used in conditionals.
Updated by stbuehler over 16 years ago
- Target version changed from 1.4.20 to 1.4.21
Updated by icy about 16 years ago
- Target version changed from 1.4.21 to 1.4.22
- Patch available set to Yes
Updated by stbuehler about 16 years ago
- Target version changed from 1.4.22 to 1.4.23
Updated by stbuehler almost 16 years ago
- Status changed from New to Wontfix
If someone needs this feature, he has to apply that path himself. I think it is too dangerous.
And a proxy shouldn't modify the Host: header imho (unless you really want that, in which case you don't want to revert the change).
Updated by gstrauss about 1 year ago
- Status changed from Wontfix to Fixed
- Target version deleted (
1.4.23) - ASK QUESTIONS IN Forums set to No
lighttpd 1.4.60 mod_magnet allows modifications to lighty.r.req_header[]
, but mod_magnet doc warns:
lighty.r.req_header[] allows get/set of request headers
If modifications would affect config processing, script should return
lighty.RESTART_REQUEST to have lighttpd restart the modified request.
and the script would have to avoid looping after the request processing restart, e.g. by checking if lighty.r.req_header["Host"] == lighty.r.req_header["X-Forwarded-Host"]
Also available in: Atom