I
I
Ivan Semenov2022-02-09 14:55:48
Nginx
Ivan Semenov, 2022-02-09 14:55:48

How to proxy API requests to the backend server through NGINX?

Good afternoon!
There is NGINX which proxies requests to the internal backend server.
Recently there was a task to transfer data via the Yandex API to this server on a specific port.
Honestly, I have never come across this, tell me how to implement it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Korotenko, 2022-02-09
@firedragon

so be it

location /yaapi/ {
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_pass http://api.yandex.ru/api;
}

from your app use
get https://youserver.com/yaapi/getUserName/42

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question