如果存在特殊标题,则NGINX应添加参数
Nginx是否有任何简单的方法可以在路径上添加参数?
我是Nginx的新手,无论如何与配置有些混淆。 (长期Apache用户):
示例我要做的事情:
Request Header :
GET /xxxx/yyyy?page=10 HTTP/1.1.
x-my-special : true.
If (x-my-special is true) ; then
add_parameter(x-my-special=true)
Result before the web application get it :
Path : /xxxx/yyyy?page=10&x-my-special=true
如果您能为我提供帮助或有提示,那就非常好。
is there any simple way with nginX to add a parameter to the path ?
I am new to nginX and a bit confused with the configuration anyway. (long term Apache user) :
Example what I am trying to do:
Request Header :
GET /xxxx/yyyy?page=10 HTTP/1.1.
x-my-special : true.
If (x-my-special is true) ; then
add_parameter(x-my-special=true)
Result before the web application get it :
Path : /xxxx/yyyy?page=10&x-my-special=true
Would be really nice if you could help or have a hint for me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果
对您来说
是可以的,那么最简单的方法将是
,或者,从
x-my特殊
header中添加任何非空值:如果块应应放置在
服务器
配置级别。但是,根据您的实际配置,它可能会多次执行该块,而正确放置它的唯一方法是查看您的整个NGINX配置。If
instead of
will be ok to you, the simplest way will be
or, to add any non-empty value from the
X-My-Special
header:This
if
block should be placed at theserver
configuration level. However, depending on your actual config, it may come this block will be executed more than once, and the only way to place it properly will be to see your whole nginx configuration.