Keywords: iOS 9 | App Transport Security | HTTP URL Loading | Info.plist Configuration | Network Security
Abstract: This technical paper provides an in-depth analysis of App Transport Security (ATS) in iOS 9, focusing on secure HTTP URL loading configurations. It covers detailed implementation methods through Info.plist, including NSExceptionDomains and NSAllowsArbitraryLoads, with complete code examples and best practice recommendations for developers.
Overview of App Transport Security Mechanism
App Transport Security (ATS), introduced in iOS 9, represents a significant security enhancement that mandates the use of secure HTTPS connections for all network communications. By default, ATS requires Transport Layer Security (TLS) version 1.2 or higher and enforces security standards such as forward secrecy. This mechanism substantially improves data transmission security, effectively preventing man-in-the-middle attacks and data eavesdropping.
Challenges with HTTP Connections in Development Environments
In local development environments, developers often encounter situations where immediate HTTPS deployment is impractical. When applications attempt to connect to locally hosted HTTP services, ATS blocks these connections and generates the error: "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection." This presents substantial obstacles to development and debugging workflows.
Domain Exception Configuration Methods
For specific HTTP connection requirements, Apple provides granular exception configuration capabilities. By adding NSExceptionDomains configurations to the Info.plist file, developers can enable HTTP loading permissions for particular domains. Below is a comprehensive configuration example:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>testdomain.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<true/>
<key>NSExceptionMinimumTLSVersion</key>
<string>TLSv1.2</string>
<key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
<false/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<true/>
<key>NSThirdPartyExceptionMinimumTLSVersion</key>
<string>TLSv1.2</string>
<key>NSRequiresCertificateTransparency</key>
<false/>
</dict>
</dict>
</dict>
Each key parameter in this configuration carries specific semantic meaning: NSIncludesSubdomains controls whether subdomains are included, NSExceptionAllowsInsecureHTTPLoads permits insecure HTTP loading, and NSExceptionMinimumTLSVersion specifies the minimum TLS version requirement. Developers can selectively configure these parameters based on actual requirements.
Risks and Applicable Scenarios for Global Exceptions
For scenarios requiring complete ATS disablement, Apple provides the NSAllowsArbitraryLoads option:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
However, Apple explicitly emphasized during WWDC sessions that using this configuration without legitimate justification may result in app review rejection. NSAllowsArbitraryLoads is primarily suitable for user-generated content scenarios, such as link sharing or custom web browsers. Even in these cases, developers should still configure ATS exceptions for URLs under their control.
Best Practice Recommendations
Following Apple's official guidance, developers should prioritize configuring exceptions for specific domains rather than globally disabling ATS. For local development environments, it's recommended to configure exceptions for localhost or specific development domains. In production environments, migration to HTTPS services should be expedited to ensure compliance with ATS security standards.
Users of development frameworks like Meteor may encounter connection issues in iOS 9 environments, which demonstrates ATS mechanism functionality. The long-term solution involves deploying SSL services in development environments rather than relying on exception configurations.
Technical Implementation Details
ATS implementation relies on iOS's URL loading system. When an application initiates a network request, the system examines the target URL's protocol and domain configuration. If the request doesn't meet ATS requirements and no corresponding exceptions are configured, the system automatically rejects the connection. This mechanism provides unified security protection at the system level.
Developers should understand that ATS exception configurations represent temporary solutions, with the ultimate goal being comprehensive HTTPS adoption. When configuring exceptions, careful security risk assessment is essential to ensure no potential security vulnerabilities are introduced.