在lighttpd Configiuration中访问X-Forwarded-Proto [英] Access X-Forwarded-Proto in lighttpd Configiuration
问题描述
我在AWS负载均衡器后面有一个lighttpd服务器。 ELB为我处理所有SSL内容,并通过端口80上的HTTP将请求转发给lighttpd,并在此过程中设置X-Forwarded-Proto标头。
I’ve got a lighttpd server behind an AWS load balancer. The ELB handles all the SSL stuff for me and forwards the requests to lighttpd over HTTP on port 80, setting the X-Forwarded-Proto header along the way.
当我只希望通过HTTPS和其他所有内容通过HTTP访问,我想在lighttpd配置文件中设置重定向,例如:
As I only want to have one specific page go via HTTPS and everything else over HTTP, I wanted to setup redirects in the lighttpd config file, like:
$HTTP["scheme"] == "https" {
$HTTP["host"] !~ ".*ttc/(index.html)?$" {
$HTTP["host"] =~ "(.*)" {
url.redirect = ( "^(.*)$" => "http://%1$1")
}
}
}
这当然不起作用,因为只有lighttpd看到HTTP请求...
This, of course, doesn’t work, as lighttpd only sees HTTP requests…
我查看了mod_extforward,但这似乎只能提供对X-Forwarded-For标头的访问。
I had a look at mod_extforward, but that only seems to provide access to the X-Forwarded-For header.
我会感谢任何关于如何解决这个问题的建议,而不必改用lighttpd。
I’ll appreciate any suggestions on how to address this, without switching away from lighttpd.
推荐答案
你使用的是什么版本的lighttpd?我正在查看1.4.36并看到mod_extforward.c确实处理了X-Forwarded-Proto。
What version of lighttpd are you using? I am looking at 1.4.36 and see that mod_extforward.c does handle X-Forwarded-Proto.
如果这仍然不适用于lighttpd 1.4.36,也许mod_extforward需要在lighttpd.conf中的其他模块之前加载?
If this still does not work for you with lighttpd 1.4.36, perhaps mod_extforward needs to be loaded prior to some other modules in your lighttpd.conf?
这篇关于在lighttpd Configiuration中访问X-Forwarded-Proto的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!