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.

link|improve this question
feedback

1 Answer

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.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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