diff --git a/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/SPI/LivenessStreamingURL.swift b/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/SPI/LivenessStreamingURL.swift index 93ee45ad3c..15c25593d2 100644 --- a/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/SPI/LivenessStreamingURL.swift +++ b/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/SPI/LivenessStreamingURL.swift @@ -7,8 +7,20 @@ import Foundation +private let isoPartitionBaseDomain: String = "csp.hci.ic.gov" +private let defaultBaseDomain: String = "amazonaws.com" + func streamingSessionURL(for region: String) throws -> URL { - let urlString = "wss://streaming-rekognition.\(region).amazonaws.com/start-face-liveness-session-websocket" + + // Determine the base domain based on the region + let baseDomain: String + if region.lowercased().starts(with: "us-isof") { + baseDomain = isoPartitionBaseDomain + } else { + baseDomain = defaultBaseDomain + } + + let urlString = "wss://streaming-rekognition.\(region).\(baseDomain)/start-face-liveness-session-websocket" guard let url = URL(string: urlString) else { throw FaceLivenessSessionError.invalidRegion }