Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Update hc-vault-connection-fns.ts

Daniel Hougaard35972ac3bf21
diff --git a/backend/src/services/app-connection/hc-vault/hc-vault-connection-fns.ts b/backend/src/services/app-connection/hc-vault/hc-vault-connection-fns.ts
index 676906a8bb..725db975ff 100644
--- a/backend/src/services/app-connection/hc-vault/hc-vault-connection-fns.ts
+++ b/backend/src/services/app-connection/hc-vault/hc-vault-connection-fns.ts
@@ -142,7 +142,10 @@ export const requestWithHCVaultGateway = async <T>(
}
const [targetHost] = await verifyHostInputValidity({ host: url.hostname, isGateway: true, isDynamicSecret: false });
- const targetPort = url.port ? Number(url.port) : 8200; // 8200 is the default port for Vault self-hosted/dedicated
+
+ // port is empty string when using protocol's default port (443 for https, 80 for http)
+ // eslint-disable-next-line no-nested-ternary
+ const targetPort = url.port ? Number(url.port) : url.protocol === "https:" ? 443 : 80;
const gatewayConnectionDetails = await gatewayV2Service.getPlatformConnectionDetailsByGatewayId({
gatewayId,