How to redirect Service Discovery URL to a different domain?

This guide provides step-by-step instructions for configuring the Service Discovery URL for Apple Account-Driven User Enrollment when the organization prefers to use a domain that is different from the verified domain used in ABM. The HTTP 302 redirect method is used to ensure proper redirection and configuration.

Sample Scenario

  • Verified Domain in ABM : domain1.com (used for creating Managed Apple IDs).
  • Organization preferred Domain : www.domain2.com (actual domain where the server is hosted).

Since the domains differ, an HTTP 302 redirect is required to configure the Service Discovery URL correctly.

Step 1: Configure HTTP Redirect from Verified Domain to Organization Domain

Set up an HTTP 302 Redirect:

  • Redirect requests from the verified domain (domain1.com) to the organization's preferred domain (www.domain2.com).
  • The redirect should point from:
    https://domain1.com/.well-known/com.apple.remotemanagement
    to:
    https://www.domain2.com/.well-known/com.apple.remotemanagement
  • Ensure the HTTP status code for the redirect is 302.

Example Configuration: If using a web server like Apache or Nginx, configure the redirect in the server settings. For example:

Apache: Redirect 302 /.well-known/com.apple.remotemanagement https://www.domain2.com/.well-known/com.apple.remotemanagement

Nginx: location /.well-known/com.apple.remotemanagement {
return 302 https://www.domain2.com/.well-known/com.apple.remotemanagement;
}

Step 2: Configure Service Discovery on the Organization Domain

  • Host the Service Discovery File:
  • On the organization's preferred domain (www.domain2.com), create the following URL path:
    https://www.domain2.com/.well-known/com.apple.remotemanagement
  • This URL should return the contents of the ServiceDiscoveryData.json file downloaded from your MDM console.
  • Set HTTP Response Headers:
    • Ensure the following HTTP response headers are configured:
      • HTTP Status Code: 200
      • Content-Type: application/json
      • Content-Length: {actual-length-of-contents-in-ServiceDiscoveryData.json}

Step 3: Test the Configuration

Use curl to Verify the Setup: Run the following command to test the HTTP redirect and service discovery configuration:
curl -i -L https://{domain}/.well-known/com.apple.remotemanagement
Replace {domain} with the verified domain used in ABM (e.g., domain1.com)

curl -i -L https://domain1.com/.well-known/com.apple.remotemanagement

HTTP/2 302
content-type: text/plain; charset=utf-8
location: https://www.domain2.com/.well-known/com.apple.remotemanagement

HTTP/2 200
content-type: application/json
content-length: 132

{

"Servers": [

{

"Version": "mdm-byod",

"BaseURL": "https://mdm.manageengine.in/mdm/client/v1/enroll?templateToken=1234&encapiKey=1234"

} ]

}

Expected Output: The command should first return a 302 redirect to the organization's preferred domain. The final response should include the contents of ServiceDiscoveryData.json with a 200 status code and the correct headers.

Step 4: Add Verified Domain in Apple User Enrollment

Complete the Enrollment: Once the configuration is verified, add the verified domain (e.g., domain1.com) in Apple User Enrollment settings. Save the configuration to finalize the setup. For further guidance on MDM enrollment, refer our Apple User Enrollment guide.

Back to Top