Lighttpd覆盖设置http头

lighty 1.4 的 setenv 模块是可以操作 http 头的, 但它提供的三个指令实际只是把给定的值附加进去, 如果处理的请求本来有同名的头, 会变成这样:
Host: foo.com, bar.com

X_FORWARD_FOR 这样的头可以如此处理, 但 Host 之类就不是希望的结果了.比如作为代理时, 伺服的主机名和后端伺服的不同, 需要覆盖掉 Host 头.

lighty 1.5 和 nginx 都提供了对应的指令, 1.4 下面得自助. 这里我添加了一个 set-request-header 指令, 顾名思义(set vs add), 会用给定值覆盖设置请求头的值. 响应头的因为我用不到所以没实现, 需要的同学自己折腾吧.

patch 放在 lighty 的论坛上, 但几个月了没人理, 是没人需要鹰语太烂还是要开 issue 才行?

This entry was posted in tech and tagged , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

2 Comments

  1. Posted 2009-12-6 at 09:44 | Permalink

    留言

  2. Posted 2009-12-6 at 09:51 | Permalink

    可能写得不够好玩吧

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>