Nginx rewrite rule with proxy pass

Posted by Yoldar-Zi on Server Fault See other posts from Server Fault or by Yoldar-Zi
Published on 2012-11-30T08:46:06Z Indexed on 2012/12/01 5:06 UTC
Read the original article Hit count: 488

Filed under:
|

I'm trying to implement nginx rewrite rules for the following situation

Request:

http://192.168.64.76/Shep.ElicenseWeb/Public/OutputDocuments.ashx?uinz=12009718&iinbin=860610350635 

Should be redirected to:

http://localhost:82/Public/OutputDocuments.ashx?uinz=12009718&iinbin=860610350635 

I tried this with no luck:

location /Shep.ElicenseWeb/ {
    rewrite ^/Shep.ElicenseWeb/ /$1 last;
    proxy_pass http://localhost:82;
}

What is the correct way to perform such a rewrite for nginx ?

© Server Fault or respective owner

Related posts about nginx

Related posts about rewrite