{"id":15979064,"url":"https://github.com/perry-mitchell/docker-host-url","last_synced_at":"2026-06-20T13:31:13.315Z","repository":{"id":57213949,"uuid":"414083814","full_name":"perry-mitchell/docker-host-url","owner":"perry-mitchell","description":"URL host resolver for Docker applications","archived":false,"fork":false,"pushed_at":"2022-09-12T05:41:57.000Z","size":120,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-13T13:26:08.730Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/perry-mitchell.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-06T05:42:04.000Z","updated_at":"2021-10-28T11:54:38.000Z","dependencies_parsed_at":"2022-08-31T18:01:17.610Z","dependency_job_id":null,"html_url":"https://github.com/perry-mitchell/docker-host-url","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/perry-mitchell/docker-host-url","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perry-mitchell%2Fdocker-host-url","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perry-mitchell%2Fdocker-host-url/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perry-mitchell%2Fdocker-host-url/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perry-mitchell%2Fdocker-host-url/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/perry-mitchell","download_url":"https://codeload.github.com/perry-mitchell/docker-host-url/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perry-mitchell%2Fdocker-host-url/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34572423,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-20T02:00:06.407Z","response_time":98,"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":[],"created_at":"2024-10-07T23:40:55.945Z","updated_at":"2026-06-20T13:31:13.300Z","avatar_url":"https://github.com/perry-mitchell.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker Host URL\n\u003e URL host resolver for Docker applications\n\nThis library provides URL resolving helpers that resolve URLs that contain the domain `host.docker.internal`. On Mac and Linux hosts this resolves differently, and this library is designed to handle both types of hosts.\n\nYou can pass a variety of values to the resolution functions that will detect and replace `host.docker.internal`:\n\n * HTTP/HTTPS URLs: `http://host.docker.internal/some/page`\n * Other protocols: `ftp://host.docker.internal/dir`\n * Just the domain: `host.docker.internal`\n * URLs with credentials: `mysql://user:password@host.docker.internal:3306/dbname`\n\n## Installation\n\nInstall this library as a dependency to use in any environment:\n\n```shell\nnpm install docker-host-url --save\n```\n\n## Usage\n\nConsider an internal application URL like `http://host.docker.internal:8080/api/resource` - when being requested from inside a Docker application this may not resolve correctly. Using this library, a call like the following would be able to resolve it to an IP address:\n\n```typescript\nimport { resolveURL } from \"docker-host-url\";\n\n// ...\n\nconst url = await resolveURL(\"http://host.docker.internal:8080/api/resource\");\n// url = http://172.17.0.1:8080/api/resource\n```\n\nWhereas URLs _not_ containing `host.docker.internal` will not be changed:\n\n```typescript\nconst url = await resolveURL(\"https://test.com:8080/api/resource\");\n// url = https://test.com:8080/api/resource\n```\n\nThis difference allows you to continue using this library in production as it will have no effect on other domains.\n\n### Sync usage\n\nThis library makes async calls to resolve the `host.docker.internal` domain, so sync use is not possible without first performing some async call. In situations where you're able to run some async task before the application properly starts, you can call the `init` function to resolve the domain early, allowing you to later call `resolveURLSync` synchronously.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperry-mitchell%2Fdocker-host-url","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fperry-mitchell%2Fdocker-host-url","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperry-mitchell%2Fdocker-host-url/lists"}