Answer the question
In order to leave comments, you need to log in
Double slash instead of one in uri - is there a difference?
If, due to some kind of jamb, when forming a request, say, to api, instead of one slash, there are two slashes in some place in the request - does it matter? Will this lead to random errors or longer processing of the request by the server? Or some other side effect?
Answer the question
In order to leave comments, you need to log in
depending on how the routing is done. In most cases, this is a critical error that will result in 404 \ 403
nginx merges slashes by default - merge_slashes off; // on by default
This can lead to surprises.
For example, if you are using nginx cache, the cache key is built from the url.
You will go to site/page.html, and 404 is cached there, because the crooked parser went to site//page.html, and your backing gave nginx 404, which it cached into the md5 key (site/page.html)
Plus it's crooked a request for a back, which in idle will look for a page, which is so clear that there is none.
The treatment option I see at the moment is to add merge_slashes off; before the server
section
And at the beginning of the server section, write two regular expressions.
rewrite ^//([^/].*) /$1 permanent;
rewrite (.*)//+(.*) /404 permanent;
rewrite (.*)//+(.*) $1/$2 permanent;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question