Proxying SDK Network Calls
Overview
Various regulations require apps provided by network providers to not consume data. Companies have previously managed this by whitelisting specific URLs which prevents the use of end user data while using the app. However, one big limitation is that only specific domains or subdomains can be whitelisted, not paths. Since the OneTrust SDK makes calls to various endpoints to fetch data, there was no way to override these to custom domains.
To address this limitation, the SDK now provides for the ability to override the URLs it uses. This allows customers to proxy the network calls made from the OneTrust SDK when performing the following actions:
- Download OneTrust SDK data
- Download logos (e.g., Banner, Preference Center, App Tracking Transparency, Age Gate)
- Download vendor lists (General, Google, and IAB)
- Log consent receipts
In addition to regulatory compliance, this feature is also useful for companies that have security restrictions regarding third party network calls and internal apps that can't reach networks outside of the corporate intranet.
Setting up the proxy on iOS
- Implement the interface
CustomConfigurator
in your application class and set the URLs to be used for each proxy type.extension AppDelegate: CustomCongiurator { func getProxyDomain(for type: ProxyType) -> URL? { // The proxy URLs will be trigerred whenever OT SDK is trying to hit the original URL flows. switch type { case .sdkDataDownload: return URL(string: "https://customendpoint.com") case .bannerLogo(let url), .pcLogo(let url), .ageGateLogo(let url), .attPrePromptLogo(let url), .attPostPromptLogo(let url): let originalPathExt = url.pathComponents.last ?? "" return URL(string: "https://customendpoint.com" + "static/\(originalPathExt)") case. iabVendors(let url), .googleVendors(let url), .generalVendors(let url): let originalPathExt = url.pathComponents.last ?? "" let urlString = "https://customendpoint.com" + originalPathExt return URL(string: urlString) case. logConsent(let url): return URL(string: "https://customendpoint.com") } } }
- Set
customConfigurator
to theOTPublishersHeadlessSDK
shared instance.func application(_ application: UIApplication,didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { OTPublishersHeadlessSDK.shared.customConfigurator = self startSDK() return true }
Ensure the customConfigurator
instance is set before calling startSDK()
.
IMPORTANT
If an empty or null URL is passed in step 2, the SDK will default to our original endpoints to fetch data.
Updated about 2 months ago