S
S
Snowindy2012-03-06 15:43:39
Nginx
Snowindy, 2012-03-06 15:43:39

Recommend a proxy server for request mapping

Situation:
Application A provides a web service available at srv1.ru:80/Address1.
These addresses are registered with Third Party System B and cannot be re-registered.

After refactoring, application A changed the web service address to srv1.ru:8080/Address2

I want to put a proxy server between A and B that will map both addresses to the actual web service address.

At the same time, I want the proxy to be asynchronous (for example, nginx), lightweight, and support wildcards (i.e., the '*' sign in the path).

I would be happy with an example config for nginx.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vitaly Peretyatko, 2012-03-06
@Snowwindy

In the simplest case, the config is

server {
listen 80;
server_name srv1.ru;
location /Address1 {
proxy_pass srv1.ru:8080/Address2;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

S
Stdit, 2012-03-06
@Stdit

Here everything is written in all details: nginx.org/ru/docs/http/ngx_http_proxy_module.html
In short, you need to set the location with proxy_pass, and if necessary (if the uri changes) with rewrite. If many identical requests go to an external service, you can additionally set proxy_cache.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question