nginx:如何在网址中保留双斜杠 [英] nginx: How to keep double slashes in urls

查看:677
本文介绍了nginx:如何在网址中保留双斜杠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Web服务,它需要多个过滤器参数,例如:

I have web service which takes several filter parameters, something like :

http://mydomain.com/filter1/value1/filter2/value2/filter3/value3

棘手的事情是有时某些过滤器变量不存在,因此可以将此类URL传递给此服务:

The tricky thing is sometimes some of the filter variables are absent, so urls as such could be passed to this service:

http://mydomain.com/filter1//filter2//filter3/value3

现在,我需要配置我的nginx(或fastcgi)以保持双斜杠.目前,它正在将双斜杠替换为单斜杠.我是nginx&的新手fastcgi配置,我不知道该怎么做.当我请求第二个URL时,我从我的php脚本中捕获了request_uri,我得到了

Now I need to configure my nginx (or fastcgi) to keep the double slashes. Currently it's replacing double slashes to single ones. I'm new to nginx & fastcgi configuration and I don't know how to do that. I captured the request_uri from my php script when I requested the second url, and I got

http://mydomain.com/filter1/filter2/filter3/value3

请帮助我.预先感谢.

推荐答案

syntax: merge_slashes [on|off]
default: merge_slashes on
context: http, server

您必须使用:merge_slashes off;

这篇关于nginx:如何在网址中保留双斜杠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆