magnit_api/nginx/magnit-api.location.conf.example
2026-03-09 11:04:49 +03:00

28 lines
1.1 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Вариант 1: nginx работает на хосте, а docker-compose публикует API только в loopback.
location /magnit-api/ {
proxy_pass http://127.0.0.1:18080/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
}
# После этого запросы выглядят так:
# /magnit-api/price?store_code=618224&query=Red%20Bull
# Вариант 2: nginx тоже в Docker и находится в одной сети с сервисом magnit-api.
# Тогда вместо loopback можно проксировать по имени сервиса:
#
# location /magnit-api/ {
# proxy_pass http://magnit-api:8080/;
# proxy_http_version 1.1;
#
# proxy_set_header Host $host;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Proto $scheme;
# proxy_set_header X-Forwarded-Host $host;
# }