基于请求标头的条件 Lighttpd 配置

发布于 2024-09-04 07:11:21 字数 308 浏览 0 评论 0原文

是否可以根据自定义请求标头有条件地配置 Lighttpd?

可以通过IP地址(和其他变量)来做到这一点:

$HTTP["remoteip"] ==  "0.0.0.0" {
    // Do something
}

是否有类似的请求标头,例如:

$HTTP["X-Some-Header"] ==  "Value" {
    // Do something
}

我不认为有查看文档和搜索Google,但也许有人知道一种方法。

谢谢

Is it possible to conditionally configure Lighttpd based on custom request headers?

It's possible to do so by IP address (and other variables):

$HTTP["remoteip"] ==  "0.0.0.0" {
    // Do something
}

Is there something similar for request headers, for example:

$HTTP["X-Some-Header"] ==  "Value" {
    // Do something
}

I don't think there is looking through documentation and searching Google, but perhaps somebody knows a way.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

鲸落 2024-09-11 07:11:21

经过更多搜索后,我非常有信心这是不可能的。

对我来说,解决方案是更改我的应用程序。

Following more searching I'm pretty confident that this isn't possible.

For me the solution was to change my application.

二手情话 2024-09-11 07:11:21

从 1.4.6 开始,您可以使用 Lighttpd 执行此操作,请参阅 https://redmine。 lighttpd.net/projects/1/wiki/docs_configuration

在我的例子中,它看起来像:

$REQUEST_HEADER["Content-Type"] == "application/rdf+xml" { 
    url.redirect = ( "^/somewhere/(.*)$" => "/somewhere-else" ) 
}

You can do this with with Lighttpd from 1.4.6 onwards, see https://redmine.lighttpd.net/projects/1/wiki/docs_configuration

In my case it looks something like:

$REQUEST_HEADER["Content-Type"] == "application/rdf+xml" { 
    url.redirect = ( "^/somewhere/(.*)$" => "/somewhere-else" ) 
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文