Advise a proxy server for mapping requests

Situation:
Annex a provides a web service, available at srv1.EN:80/Address1.
These addresses are registered in third-party system B and re-register them is impossible.

After refactoring, the application And changed the web address of the web service on srv1.EN:8080/Address2

I want to put between A and B a proxy server that will mappit both addresses on the current web service.

If you want your proxy to be asynchronous (for example, nginx), light, support wild cards (i.e. '*' symbols in the path).

I will be glad to example configuration for nginx.
October 8th 19 at 02:28
2 answers
October 8th 19 at 02:30
Solution
In the simplest case, the config like this
server { <br> listen 80; <br> server_name srv1.ru;<br> <br / > location /Address1 {<br> proxy_pass <a href="http://srv1.ru">srv1.ru</a>:8080/Address2;<br> proxy_set_header Host $Host;<br> proxy_set_header X-Real-IP $remote_addr;<br> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br> }<br> }
thank you! - joseph commented on October 8th 19 at 02:33
October 8th 19 at 02:32
Here all all the details is written: nginx.org/ru/docs/http/ngx_http_proxy_module.html
In short, you need to put the proxy_pass location c, and if necessary (if you change the uri) with the rewrite. If the external service goes a lot of the same queries, you can optionally set proxy_cache.
Example rewrite:
rewrite /oldaddress/(\d+).php /newadress/$1.html break; - joseph commented on October 8th 19 at 02:35
thanks for the reply - emmitt_Kohl commented on October 8th 19 at 02:38

Find more questions by tags ProxyNginx