{"id":19278356,"url":"https://github.com/icewhaletech/casaos-gateway","last_synced_at":"2025-04-22T00:31:49.664Z","repository":{"id":53501894,"uuid":"517803471","full_name":"IceWhaleTech/CasaOS-Gateway","owner":"IceWhaleTech","description":"CasaOS Gateway is a dynamic API gateway service that can be used to expose APIs from different other HTTP based services.","archived":false,"fork":false,"pushed_at":"2025-02-10T09:26:30.000Z","size":226,"stargazers_count":20,"open_issues_count":1,"forks_count":24,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-11T09:52:29.480Z","etag":null,"topics":["api-gateway","gateway","go","golang","http","rest-api"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IceWhaleTech.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":"2022-07-25T19:59:47.000Z","updated_at":"2025-03-04T23:50:36.000Z","dependencies_parsed_at":"2024-06-03T11:26:29.302Z","dependency_job_id":null,"html_url":"https://github.com/IceWhaleTech/CasaOS-Gateway","commit_stats":null,"previous_names":[],"tags_count":44,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IceWhaleTech%2FCasaOS-Gateway","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IceWhaleTech%2FCasaOS-Gateway/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IceWhaleTech%2FCasaOS-Gateway/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IceWhaleTech%2FCasaOS-Gateway/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IceWhaleTech","download_url":"https://codeload.github.com/IceWhaleTech/CasaOS-Gateway/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250157832,"owners_count":21384331,"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","gateway","go","golang","http","rest-api"],"created_at":"2024-11-09T21:09:23.217Z","updated_at":"2025-04-22T00:31:49.418Z","avatar_url":"https://github.com/IceWhaleTech.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CasaOS-Gateway\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/IceWhaleTech/CasaOS-Gateway.svg)](https://pkg.go.dev/github.com/IceWhaleTech/CasaOS-Gateway) [![Go Report Card](https://goreportcard.com/badge/github.com/IceWhaleTech/CasaOS-Gateway)](https://goreportcard.com/report/github.com/IceWhaleTech/CasaOS-Gateway) [![goreleaser](https://github.com/IceWhaleTech/CasaOS-Gateway/actions/workflows/release.yml/badge.svg)](https://github.com/IceWhaleTech/CasaOS-Gateway/actions/workflows/release.yml) [![codecov](https://codecov.io/gh/IceWhaleTech/CasaOS-Gateway/branch/main/graph/badge.svg?token=5JIHXF1RJ4)](https://codecov.io/gh/IceWhaleTech/CasaOS-Gateway)\n\nCasaOS Gateway is a dynamic API gateway service that can be used to expose APIs from different other HTTP based services.\n\nThis gateway service comes with a simple management API for other services to register their APIs by route paths. A HTTP request arrived at gateway port will be forwarded to the service that is registered for the route path.\n\n\u003e As a best practice, a service behind this gateway should bind to localhost (`127.0.0.1` for IPv4, `::1` for IPv6) ONLY, so no external network access is allowed.\n\n## Configuration\n\nUpon launching, it will search for `gateway.ini` file in the following order:\n\n```bash\n./gateway.ini\n./conf/gateway.ini\n$HOME/.casaos/gateway.ini\n/etc/casaos/gateway.ini\n```\n\nSee [gateway.ini.sample](./build/etc/casaos/gateway.ini.sample) for default configuration.\n\n## Running\n\nOnce running, gateway address and management address will be available in the files under `RuntimePath`  specified in configuration.\n\n```bash\n$ cat /var/run/casaos/gateway.url \n[::]:8080 # port is specified in configuration\n\n$ cat /var/run/casaos/management.url \n[::]:34703 # port is randomly assigned\n```\n\n## Example\n\nAssuming that\n\n- the management API is running on port `34703`\n- the gateway is running on port `8080`\n- some API running at `http://localhost:12345/ping` that simply returns `pong`.\n\nThen register the API as follows:\n\n- POST `http://localhost:34703/v1/gateway/routes`\n\n  ```json\n  {\n          \"path\": \"/ping\",\n          \"target\": \"http://localhost:12345\"\n  }\n  ```\n\n  or in command line:\n\n  ```bash\n  $ curl 'localhost:34703/v1/gateway/routes' --data-raw '\n      {\"path\": \"/ping\", \"target\": \"http://localhost:12345\"}\n    '\n  ```\n\nNow run\n\n```bash\n$ curl localhost:8080/ping\n{\"message\":\"pong\"}\n```\n\n... which is equivalent as\n\n```bash\n$ curl localhost:12345/ping\n{\"message\":\"pong\"}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficewhaletech%2Fcasaos-gateway","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficewhaletech%2Fcasaos-gateway","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficewhaletech%2Fcasaos-gateway/lists"}