diff --git a/docs/generated/changelog.html b/docs/generated/changelog.html
index cc0ec2cf..747140c9 100644
--- a/docs/generated/changelog.html
+++ b/docs/generated/changelog.html
@@ -18,6 +18,7 @@
Version x.x.x
feat: enhances `.from` methods on public key classes to support unknown types, including PublicKey instances, ArrayBuffer-like objects, DER encoded public keys, and hex strings. Also introduces a new `bufFromBufLike` util
feat: introduces partial identities from public keys for authentication flows
fix: honor disableIdle flag
+ fix: add `github.dev` and `gitpod.io` to known hosts
Version 0.20.2
diff --git a/packages/agent/src/agent/http/http.test.ts b/packages/agent/src/agent/http/http.test.ts
index 01b2ed4e..0cd60949 100644
--- a/packages/agent/src/agent/http/http.test.ts
+++ b/packages/agent/src/agent/http/http.test.ts
@@ -733,7 +733,7 @@ describe('default host', () => {
expect((agent as any)._host.hostname).toBe('icp-api.io');
});
it('should use the existing host if the agent is used on a known hostname', () => {
- const knownHosts = ['ic0.app', 'icp0.io', '127.0.0.1', '127.0.0.1'];
+ const knownHosts = ['ic0.app', 'icp0.io', '127.0.0.1', 'localhost', 'github.dev', 'gitpod.io'];
for (const host of knownHosts) {
delete (window as any).location;
(window as any).location = {
@@ -745,7 +745,7 @@ describe('default host', () => {
}
});
it('should correctly handle subdomains on known hosts', () => {
- const knownHosts = ['ic0.app', 'icp0.io', '127.0.0.1', '127.0.0.1'];
+ const knownHosts = ['ic0.app', 'icp0.io', '127.0.0.1', 'localhost', 'github.dev', 'gitpod.io'];
for (const host of knownHosts) {
delete (window as any).location;
(window as any).location = {
@@ -757,8 +757,8 @@ describe('default host', () => {
expect((agent as any)._host.hostname).toBe(host);
}
});
- it('should handle port numbers for 127.0.0.1', () => {
- const knownHosts = ['127.0.0.1', '127.0.0.1'];
+ it('should handle port numbers for 127.0.0.1 and localhost', () => {
+ const knownHosts = ['127.0.0.1', 'localhost'];
for (const host of knownHosts) {
delete (window as any).location;
// hostname is different from host when port is specified
diff --git a/packages/agent/src/agent/http/index.ts b/packages/agent/src/agent/http/index.ts
index e3213f57..47cf7daf 100644
--- a/packages/agent/src/agent/http/index.ts
+++ b/packages/agent/src/agent/http/index.ts
@@ -223,8 +223,15 @@ export class HttpAgent implements Agent {
'Could not infer host from window.location, defaulting to mainnet gateway of https://icp-api.io. Please provide a host to the HttpAgent constructor to avoid this warning.',
);
}
- // Mainnet and local will have the api route available
- const knownHosts = ['ic0.app', 'icp0.io', '127.0.0.1', 'localhost'];
+ // Mainnet, local, and remote environments will have the api route available
+ const knownHosts = [
+ 'ic0.app',
+ 'icp0.io',
+ '127.0.0.1',
+ 'localhost',
+ 'github.dev',
+ 'gitpod.io',
+ ];
const hostname = location?.hostname;
let knownHost;
if (hostname && typeof hostname === 'string') {