Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I want to setup proxy in nginx:

location ~ ^/m/([^/]*)/([^/]*)/([^/]*)$ {
  proxy_pass http://127.0.0.1:8080/redir/m/$1/$2/$3;
  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

http:// 127.0.0.1:8080/redir/m/test/ss;

How can I get my second slash?? Thanx.

share|improve this question

1 Answer 1

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

 
discard

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.