I want to all requests that target at urls with string "serive" can be redirect to another server that run at different port:8080,for example:
....................................................................................................................................................................................................................
http://localhost/service/image-----------------> http://localhost:8080/service/image
http://localhost/service/image/upload------> http://localhost:8080/service/image/upload
http://localhost/service/blog---------------------> http://localhost:8080/service/blog .................................................................................................................................................................................................................... but blow will still served by ngnix,cause no "service" included within url
http://localhost/wiki/....
http://localhost/video/....
and I have tried:
.................................................................................................................................................................................................................... location / {
root /media/Backup/jetty/webapps;
index index.html index.htm;
if ($request_uri ~* ^/service/.*) {
rewrite ^/service/(.*)$ /$1 permanent;
proxy_pass http://localhost:8080;
}
}
but got error:301 Moved Permanently
can any body tell how to solve this problem?
Thanks