0

I need proxing to different backend but whith same url, so rewriting thould be like this

URL: http://myservrer.com/server/monitoring1?(parameters) REWRITE TO: http://1.1.1.1/server/monitoring?(parameters) URL: http://myservrer.com/server/monitoring2?(parameters) REWRITE TO: http://2.2.2.2/server/monitoring?(parameters) 

My current config:

location /server/monitoring1 { proxy_pass http://1.1.1.1:82/server/monitoring; } location /server/monitoring2 { proxy_pass http://2.2.2.2:82/server/monitoring; } 

How to change it with rewrite options?

1 Answer 1

0
location /server/monitoring1 { rewrite ^/server/monitoring1\?(.*) http://1.1.1.1:82/server/monitoring?$1 redirect; } location /server/monitoring2 { rewrite ^/server/monitoring2\?(.*) http://2.2.2.2:82/server/monitoring?$1 redirect; } 
2
  • 3
    This is a well-formatted example, but examples should not comprise the entire body of an answer. Adding a brief description of what you changed and why would be very helpful. Commented Apr 9, 2013 at 22:54
  • Well, the example above answers the question completely. He asked for a translation of his config using rewrites. That's what I did. Commented Apr 10, 2013 at 13:29

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.