{"id":18457995,"url":"https://github.com/alokkusingh/nginx-layer4-lb","last_synced_at":"2026-01-21T07:26:08.286Z","repository":{"id":95088474,"uuid":"289168461","full_name":"alokkusingh/nginx-layer4-lb","owner":"alokkusingh","description":"Nginx Setup for Layer 4 (Transport Layer) Load Balancer and avoid TLS off-loading","archived":false,"fork":false,"pushed_at":"2020-08-25T02:30:40.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-23T16:23:14.532Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alokkusingh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2020-08-21T03:28:30.000Z","updated_at":"2020-08-27T04:27:06.000Z","dependencies_parsed_at":"2023-03-14T08:01:00.973Z","dependency_job_id":null,"html_url":"https://github.com/alokkusingh/nginx-layer4-lb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alokkusingh/nginx-layer4-lb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alokkusingh%2Fnginx-layer4-lb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alokkusingh%2Fnginx-layer4-lb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alokkusingh%2Fnginx-layer4-lb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alokkusingh%2Fnginx-layer4-lb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alokkusingh","download_url":"https://codeload.github.com/alokkusingh/nginx-layer4-lb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alokkusingh%2Fnginx-layer4-lb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28629915,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T04:47:28.174Z","status":"ssl_error","status_checked_at":"2026-01-21T04:47:22.943Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-11-06T08:16:21.904Z","updated_at":"2026-01-21T07:26:08.269Z","avatar_url":"https://github.com/alokkusingh.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# nginx-layer4-lb\nNginx Setup for Layer 4 (Transport Layer) Load Balancer and avoid TLS offloading.\n\n## Advantage of using Layer 4 Load Balancer\n- A single TCP connection end-to-end - from client to backend server\n- No SSL offloading - this is important when server needs to authenticate a client using `X.509` certificate and extract user information from `CN` section.\n- Capture the requst/response payload size for each request\n\n## Limitations\n- Only origin based _sticky-session_ can be achieved\n\n\nFor `layer 4` load balancing `Nginx` requires `stream module`. Stream module is not part of `Nginx` build, but it is part of `NginxPLUS` build.\n\nTo use stream capability without going for `NginxPLUS` you need to download `Nginx` Source Code and build using `--with-stream_realip_module` compiler flag. This wil add stream dynamic module to the installer.\n\n## Download Source Code and Build\n\n#### Download Source Code\n    wget https://nginx.org/download/nginx-1.19.1.tar.gz \u0026\u0026 tar zxvf nginx-1.19.1.tar.gz\n\n#### Configure Stream Module\n    cd nginx-1.19.1\n    ./configure \\\n    \t--user=aloksingh \\\n        --prefix=/usr/local/nginx_l4 \\\n        --with-stream=dynamic \\\n        --with-stream_realip_module\n\n#### Build the Installer\n    make install\n\n## Nginx Setup\nPlease refer `nginx.conf` file under `conf` directory.\n\n## Hit the Secure URL\n    curl --cacert rootCA_Alok.crt --key clientAlok.key --cert clientAlok.crt https://localhost:443/api/user\n    \n   Where:\n   - `rootCA_Alok.crt` is a backend server Root Certificate for `localhost`\n   - `clientAlok.key` is client private key\n   - `clientAlok.crt` is client certificate\n   - Assuming the `clientAlok.crt` signed using `Root Certificate` that is available at Server's `Trust Store`. So that server can trust the client certificate.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falokkusingh%2Fnginx-layer4-lb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falokkusingh%2Fnginx-layer4-lb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falokkusingh%2Fnginx-layer4-lb/lists"}