{"id":29092373,"url":"https://github.com/lyokha/nginx-proxy-peer-host","last_synced_at":"2026-04-28T13:35:06.491Z","repository":{"id":288121733,"uuid":"843076360","full_name":"lyokha/nginx-proxy-peer-host","owner":"lyokha","description":"Variable $proxy_peer_host","archived":false,"fork":false,"pushed_at":"2025-04-15T16:39:14.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-15T17:40:51.460Z","etag":null,"topics":["nginx","proxy","proxy-peer-host","proxy-ssl-name","upstream"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lyokha.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-08-15T18:22:22.000Z","updated_at":"2025-04-15T16:34:12.000Z","dependencies_parsed_at":"2025-04-15T17:51:02.315Z","dependency_job_id":null,"html_url":"https://github.com/lyokha/nginx-proxy-peer-host","commit_stats":null,"previous_names":["lyokha/nginx-proxy-peer-host"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/lyokha/nginx-proxy-peer-host","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyokha%2Fnginx-proxy-peer-host","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyokha%2Fnginx-proxy-peer-host/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyokha%2Fnginx-proxy-peer-host/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyokha%2Fnginx-proxy-peer-host/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lyokha","download_url":"https://codeload.github.com/lyokha/nginx-proxy-peer-host/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyokha%2Fnginx-proxy-peer-host/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262389471,"owners_count":23303341,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nginx","proxy","proxy-peer-host","proxy-ssl-name","upstream"],"created_at":"2025-06-28T07:06:11.396Z","updated_at":"2026-04-28T13:35:06.457Z","avatar_url":"https://github.com/lyokha.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"nginx-proxy-peer-host\n=====================\n\n[![Build Status](https://github.com/lyokha/nginx-proxy-peer-host/workflows/CI/badge.svg)](https://github.com/lyokha/nginx-proxy-peer-host/actions?query=workflow%3ACI)\n\nThis Nginx HTTP module provides only one variable *\u0026dollar;proxy_peer_host*\nwhich is similar to variable *\u0026dollar;proxy_host* from [Nginx HTTP proxy\nmodule](https://nginx.org/en/docs/http/ngx_http_proxy_module.html). While the\nlatter variable contains the name of the upstream which a client request is\nbeing proxied to, variable *\u0026dollar;proxy_peer_host* contains the name of the\nactual server inside the upstream given it was configured in directive\n*upstream*.\n\nLet's test a simple configuration.\n\n```nginx\nuser                    nobody;\nworker_processes        1;\n\nevents {\n    worker_connections  1024;\n}\n\nhttp {\n    default_type        application/octet-stream;\n    sendfile            on;\n\n    upstream u1 {\n        server 127.0.0.1:8080;\n        server localhost:8080;\n    }\n\n    server {\n        listen       8010;\n        server_name  main;\n\n        location /u1 {\n            proxy_pass http://u1;\n            echo_after_body \"[u1] proxy_peer_host: $proxy_peer_host\";\n            echo_after_body \"     proxy_host: $proxy_host\";\n        }\n    }\n\n    server {\n        listen       8080;\n        server_name  backend;\n\n        location / {\n            return 200;\n        }\n    }\n}\n```\n\nThe value of *\u0026dollar;proxy_peer_host* must rotate in a round-robin manner when\nwe do sequential HTTP requests to location */u1*.\n\n```ShellSession\n$ curl 'http://localhost:8010/u1'\n[u1] proxy_peer_host: 127.0.0.1:8080\n     proxy_host: u1\n$ curl 'http://localhost:8010/u1'\n[u1] proxy_peer_host: localhost:8080\n     proxy_host: u1\n$ curl 'http://localhost:8010/u1'\n[u1] proxy_peer_host: localhost:8080\n     proxy_host: u1\n$ curl 'http://localhost:8010/u1'\n[u1] proxy_peer_host: 127.0.0.1:8080\n     proxy_host: u1\n```\n\nVariable *\u0026dollar;proxy_peer_host* can be used in directive *proxy_ssl_name* to\nverify names of backend servers against the names given in directives *server*\ninside the upstream rather than the name of the upstream itself.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flyokha%2Fnginx-proxy-peer-host","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flyokha%2Fnginx-proxy-peer-host","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flyokha%2Fnginx-proxy-peer-host/lists"}