Loading

Generate files at locations for Experience Cloud or Salesforce Sites for third-party integration purposes

Julkaisupäivä: May 30, 2026
Kuvaus

Widely used third-party integrations with Apple and Android operating systems — such as deep links and payment processors — require verification of site ownership by placing specific files at defined URL paths. These paths typically start from /.well-known/ and contain individual JSON configuration files. Common examples include assetlinks.json (Android App Links) and apple-app-site-association (iOS Universal Links).
With Salesforce, it is not possible to directly serve files at the /.well-known/ path for any site. Salesforce pre-populates some endpoints at these paths. However, using Salesforce URL Rewriters, you can present a Visualforce page to the integration service that appears to be served from the correct path while actually being a Visualforce page hosting the required JSON content.
Note: This approach generates a redirect, so it does not work with services that do not follow redirects or that require a 200 OK status code to be returned directly.

Ratkaisu

Step 1: Create the Visualforce Page

Create a Visualforce page to host your required JSON content and give it a descriptive, unique name. Set the contentType attribute appropriately for your use case (for example, contentType="text/json" for JSON files). Configure the page without standard stylesheets, sidebar, or header tags to produce clean output. Each integration file (for example, assetlinks.json and apple-app-site-association) requires its own separate Visualforce page.
If your use case is for Mobile Publisher, Experience Cloud, or similar Lightning solutions, ensure the checkbox "Available for Lightning Experience, Experience Builder Sites and the mobile app" is enabled on the Visualforce page.

Step 2: Create the URL Rewriter Apex Class

Create an Apex class that implements the Site.UrlRewriter interface. The URL rewriter intercepts incoming requests and redirects them to the appropriate Visualforce page based on the URL pattern.
The class should implement the mapRequestUrl method to check whether the incoming URL matches your desired integration file path (for example, whether the URL ends with 'assetlinks.json'). If the URL matches, the method returns a new PageReference to the corresponding Visualforce page. The generateUrlFor method should return null because reverse URL mapping is not needed for this use case.
If you are integrating your third-party service across multiple Salesforce Sites, you may need to create multiple URL Rewriter classes — one for each site.

Step 3: Assign the URL Rewriter (Salesforce Sites)

  1. Enter Setup.
  2. In Quick Find, type 'Sites' and select 'Sites'.
  3. Select your site under the Site Label column.
  4. Click Edit.
  5. Use the lookup for the 'URL Rewriter Class' field to select your Apex class that implements the UrlRewriter interface.
  6. Click Save.

Step 4: Assign the URL Rewriter (Experience Cloud Sites)

  1. Enter Setup.
  2. In Quick Find, type 'All Sites' and select 'All Sites'.
  3. Select Workspaces for your site.
  4. Select the Administration tile.
  5. Select the Pages menu.
  6. Under Advanced customizations, select 'Go to Force.com'.
  7. Follow steps 4–6 from the Salesforce Sites instructions above.

Step 5: Test the Configuration

After assigning the URL rewriter, test your implementation by navigating directly to the configured path in your browser (for example, ). The browser should display the JSON content served by your Visualforce page.

Knowledge-artikkelin numero

000396664

 
Ladataan
Salesforce Help | Article