{"id":17740599,"url":"https://github.com/rusq/vhoster","last_synced_at":"2026-05-04T08:41:39.006Z","repository":{"id":176186646,"uuid":"654943340","full_name":"rusq/vhoster","owner":"rusq","description":"Vhoster is a library and a dynamic virtual host gateway","archived":false,"fork":false,"pushed_at":"2023-06-25T04:25:04.000Z","size":64,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-09T19:33:09.152Z","etag":null,"topics":["docker","docker-compose","gateway","library","network","utility","virtual-host"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rusq.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":"2023-06-17T12:03:16.000Z","updated_at":"2023-06-20T11:34:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"485301f7-d909-43f4-b89c-ca49f1aed572","html_url":"https://github.com/rusq/vhoster","commit_stats":null,"previous_names":["rusq/vhoster"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/rusq/vhoster","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusq%2Fvhoster","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusq%2Fvhoster/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusq%2Fvhoster/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusq%2Fvhoster/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rusq","download_url":"https://codeload.github.com/rusq/vhoster/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusq%2Fvhoster/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001959,"owners_count":26083244,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["docker","docker-compose","gateway","library","network","utility","virtual-host"],"created_at":"2024-10-26T03:06:43.148Z","updated_at":"2025-10-09T19:33:41.154Z","avatar_url":"https://github.com/rusq.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vhoster\n\nVhoster is a library for creating virtual hosts in a Go server. It is intended\nto be used as a library, but it also includes a gateway that can be used to\ncreate and delete vhosts dynamically.\n\nThe gateway can also be used as a central point of entry for all requests, and\nit can be used to load balance requests to multiple servers.\n\n\n## Quick Start\n\n### Locally\n\n1. Start the server listening on port 8082\n    ```sh\n    go run cmd/server/main.go\n    ```\n\n2. Start the gateway listening on port 8083\n    ```sh\n    go run cmd/gateway/main.go\n    ```\n\n3. Create the vhost in the gateway\n    ```sh\n    curl -X POST -H \"Content-Type: application/json\" -d '{\"host_prefix\": \"test\", \"target\": \"http://localhost:8082\"}' http://localhost:8083/vhost/\n    ```\n\n    then, to test, run `curl test.localhost:8081`, and you'll get the \"Hello, World!\"\n\n4. Delete the vhost in the gateway\n    ```sh\n    curl -X DELETE localhost:8083/vhost/test\n    ```\n\n### In docker compose\n\n1. Run `docker compose up`, it will build and start two container: (a) the\n   gateway on port 8080 and vhost api on port 8083, and (b) the test server on\n   port 8082, but the testserver is unreachable from the local machine\n   directly.  We will set up a virtual host to access it.\n\n   If you want to verify that testserver is not accessible, try running `curl\n   localhost:8082` and you'll get an error.\n\n2. It comes with preconfigured vhost \"test.localhost:8080\" that routes to\n   \"http://testserver:8082\".  You can verify that it works by running `curl\n   test.localhost:8080`, and you'll get the \"Hello, World!\"\n\n3. Run the following command to instruct gateway to route all requests to\n   \"hello.localhost:8080\" to \"http://testserver:8082\":\n   ```sh\n   curl -X POST -H \"Content-Type: application/json\" -d '{\"host_prefix\": \"hello\", \"target\": \"http://testserver:8082\"}' http://localhost:8083/vhost/\n   ```\n\n   This will instruct the gateway to route all requests that arrive at\n   \"test.localhost:8080\" to \"http://testserver:8082\".\n\n3. Now, you can access the test server by running `curl hello.localhost:8080`,\n   and you'll get the \"Hello, World!\"\n\n   At this point, both \"test.localhost:8080\" and \"hello.localhost:8080\" will\n   route to the test server.\n\n4. To list existing routes, and verify that, run:\n   ```sh\n   curl -X GET localhost:8083/vhost/\n   ```\n   (`-X GET` is optional and instructs curl to use GET method, which is the default\n   method for curl, so you can omit it: `curl localhost:8083/vhost/`)\n\n   The API server will respond on this GET request with JSON that lists all\n   existing vhosts.\n\n4. You can delete the route now, by running:\n   ```sh\n   curl -X DELETE localhost:8083/vhost/hello\n   ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frusq%2Fvhoster","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frusq%2Fvhoster","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frusq%2Fvhoster/lists"}