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

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

1 Answer 1

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.