{"id":18029822,"url":"https://github.com/ajaxray/haproxy-api-gateway","last_synced_at":"2026-04-11T08:03:47.351Z","repository":{"id":142566835,"uuid":"309487115","full_name":"ajaxray/haproxy-api-gateway","owner":"ajaxray","description":"API Gateway using HAProxy - Testing with docker","archived":false,"fork":false,"pushed_at":"2020-11-02T21:07:30.000Z","size":3716,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-10T05:42:04.926Z","etag":null,"topics":["api-gateway","docker","docker-compose","haproxy"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ajaxray.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}},"created_at":"2020-11-02T20:29:01.000Z","updated_at":"2020-11-02T21:13:42.000Z","dependencies_parsed_at":"2023-05-25T00:15:52.189Z","dependency_job_id":null,"html_url":"https://github.com/ajaxray/haproxy-api-gateway","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajaxray%2Fhaproxy-api-gateway","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajaxray%2Fhaproxy-api-gateway/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajaxray%2Fhaproxy-api-gateway/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajaxray%2Fhaproxy-api-gateway/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ajaxray","download_url":"https://codeload.github.com/ajaxray/haproxy-api-gateway/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247249549,"owners_count":20908212,"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":["api-gateway","docker","docker-compose","haproxy"],"created_at":"2024-10-30T09:11:36.188Z","updated_at":"2026-04-11T08:03:47.278Z","avatar_url":"https://github.com/ajaxray.png","language":"Go","readme":"Configuring API Gateway using HAProxy \n=================================\n\nThis repo was built just to test various features of HAProxy \nrelated to configuring API Gateway using docker.\n\nWhat it does?\n-----------------\nAfter `docker-compose up` it will start 3 containers.\nOne for API Gateway (HAProxy) and two others for different imaginary services - OCR and SMS.\n\n#### Service Containers\nThe service containers are running a tiny server (written in `api_server/server.go`).\nIt's listening on 8083 port and always responds with `SERVICE_NAME` and requesting URL.\nThis `SERVICE_NAME` is an env variable, set from `docker-compose.yml`.     \n\n#### API Gateway Container \nIt's based on official `haproxy:1.5`. \nIt will use (COPY) configuration file at `haproxy/haproxy.cfg`.\nWe've also added some extra hosts entry for accessing services with meaningful domain names.  \n\nIn this repo, we are going to test -\n- The API consumers will use virtual service endpoints which will be pointing to the API Gateway. \n- Then the HAProxy will route them to appropriate service providers. \n\nHow to test\n--------------------\nFirst get the repository and start the containers.\n```shell script\ngit clone https://github.com/ajaxray/haproxy-api-gateway\ncd haproxy-api-gateway\ndocker-compose build\ndocker-compose up -d\n```\n\nNow, we'll enter into the shell of gateway container. \nThen will make request using virtual domain names of services.\n```shell script\n$ docker-compose exec gateway bash\nroot@abcdef123456:/# curl 'http://sms.services.com/send/sms'\nServing by sms_service for URL \"/send/sms\".\nroot@abcdef123456:/# curl 'http://ocr.services.com/extract/content'\nServing by ocr_service for URL \"/extract/content\".\nroot@abcdef123456:/# exit\n```\nDon't forget to `docker-compose down` once testing is done.\n\nThat's all at this moment :smile:  \n \nWhat's next?\n--------------------\nThis repo contains only example of domain based **HTTP Routing**. \nBut this setup is ready for testing any other features by - \n- Setting configurations in `haproxy/haproxy.cfg`\n- Adding more services in `docker-compose.yml`   \n\nNotes\n-----\n- If you modify `haproxy/haproxy.cfg`, you have to rebuild (`docker-compose build`).\n- You DO NOT NEED to have golang installed to use this repository.\n- But, if you modify `api_server/server.go`, you have to re-compile for appropriate architecture and OS\n```shell script\ncd api_server\nGOOS=linux GOARCH=386 go build ./server.go\n```\n- You'll require Go 1.11 or higher to compile the `api_server/server.go`\n ","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajaxray%2Fhaproxy-api-gateway","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fajaxray%2Fhaproxy-api-gateway","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajaxray%2Fhaproxy-api-gateway/lists"}