Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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'd like to convert an url with the format

http:// foo.example.com:81/foo/s?id=(a number)

into something like

http:// www.example.com/foo/(a number)/

in Nginx.

I've tried with proxy_pass and rewrite but it doesn't work. I believe this is fairly simple but I'm not familiar with it. Thanks.

share|improve this question
up vote 1 down vote accepted

Well, finally I've figured it out.

location /foo {
    rewrite ^/foo/(.*)/ /foo/s?id=$1 break;
    proxy_buffering off;
    proxy_pass http://127.0.0.1:81;
}

I set proxy_buffering to off because it was a comet application.

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.