Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to setup proxy in nginx:

location ~ ^/m/([^/]*)/([^/]*)/([^/]*)$ {
  proxy_redirect off;
  proxy_set_header Host $host;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

It works but this address

http:// myhost/m/test//ss

gets translated to


How can I get my second slash?? Thanx.

share|improve this question
up vote 2 down vote accepted

You can't. A // is defined as being equivalent to /, and nginx will always reduce a URL to the canonical form before passing it on.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.