From af93e828cbf5dec5ea472bf41a6ed1bda1de3156 Mon Sep 17 00:00:00 2001 From: Adam Spofford <93943719+adamspofford-dfinity@users.noreply.github.com> Date: Mon, 19 Aug 2024 15:41:19 -0700 Subject: [PATCH] fix: Fix PocketIC domain config (#3877) --- docs/dfx-json-schema.json | 8 ++++---- docs/networks-json-schema.json | 8 ++++---- e2e/tests-dfx/frontend.bash | 9 +++++++++ src/dfx-core/src/config/model/dfinity.rs | 2 +- .../config/model/local_server_descriptor.rs | 2 +- src/dfx/src/actors/pocketic_proxy.rs | 18 ++++++++++++------ src/dfx/src/commands/start.rs | 6 +++++- 7 files changed, 36 insertions(+), 17 deletions(-) diff --git a/docs/dfx-json-schema.json b/docs/dfx-json-schema.json index 65b8712b8f..a92cf8939a 100644 --- a/docs/dfx-json-schema.json +++ b/docs/dfx-json-schema.json @@ -730,15 +730,15 @@ "ConfigDefaultsProxy": { "description": "Configuration for the HTTP gateway.", "type": "object", - "required": [ - "domain" - ], "properties": { "domain": { "description": "A list of domains that can be served. These are used for canister resolution [default: localhost]", - "allOf": [ + "anyOf": [ { "$ref": "#/definitions/SerdeVec_for_String" + }, + { + "type": "null" } ] } diff --git a/docs/networks-json-schema.json b/docs/networks-json-schema.json index 1f675c3f0e..0a8b1bf8eb 100644 --- a/docs/networks-json-schema.json +++ b/docs/networks-json-schema.json @@ -107,15 +107,15 @@ "ConfigDefaultsProxy": { "description": "Configuration for the HTTP gateway.", "type": "object", - "required": [ - "domain" - ], "properties": { "domain": { "description": "A list of domains that can be served. These are used for canister resolution [default: localhost]", - "allOf": [ + "anyOf": [ { "$ref": "#/definitions/SerdeVec_for_String" + }, + { + "type": "null" } ] } diff --git a/e2e/tests-dfx/frontend.bash b/e2e/tests-dfx/frontend.bash index b27b73d1fc..e6288b00fd 100644 --- a/e2e/tests-dfx/frontend.bash +++ b/e2e/tests-dfx/frontend.bash @@ -65,6 +65,15 @@ teardown() { assert_match "Connection refused" } +@test "dfx routes frontend based on subdomain" { + dfx_start + PORT=$(get_webserver_port) + dfx deploy + ID=$(dfx canister id e2e_project_frontend) + assert_command curl "http://$ID.localhost:$PORT/" + assert_match "
" +} + @test "dfx uses .ic-assets.json file provided in src/__project_name__frontend/assets" { echo '[{"match": "*", "headers": {"x-key": "x-value"}}]' > src/e2e_project_frontend/assets/.ic-assets.json5 diff --git a/src/dfx-core/src/config/model/dfinity.rs b/src/dfx-core/src/config/model/dfinity.rs index a3ac91b59a..b468dd1510 100644 --- a/src/dfx-core/src/config/model/dfinity.rs +++ b/src/dfx-core/src/config/model/dfinity.rs @@ -673,7 +673,7 @@ pub struct ConfigDefaultsReplica { #[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] pub struct ConfigDefaultsProxy { /// A list of domains that can be served. These are used for canister resolution [default: localhost] - pub domain: SerdeVec