Assign Salesforce Site Error Pages
Salesforce sites use Visualforce pages for site and error pages. Sample error pages use the SiteSamples static resource for their style sheet and images.
Required Editions
| Available in: both Salesforce Classic and Lightning Experience |
| Available in: Developer, Enterprise, Performance, and Unlimited Editions |
| User Permissions Needed | |
|---|---|
| To create and edit Salesforce Sites: | Customize Application OR Create and Set Up Experiences |
To set the error pages for your site:
- From Setup, enter Sites in the Quick Find box, then select Sites.
- Click the name of the site you want to modify.
- Click Page Assignment on the Error Pages related list.
-
Using the lookup fields, assign a Visualforce page or static resource for each
of the standard error conditions listed:
- Authorization Required Page—The page users see when trying to access pages for which they don’t have authorization.
- Limit Exceeded Page—The page users see when your site has exceeded its bandwidth limits.
- Maintenance Page—The page users see when your site is down for maintenance.
-
Service Not Available—No longer applicable. This custom page was previously used when Salesforce servers were unavailable for HTTP-only requests, which are no longer supported. When Salesforce servers are unavailable for a Salesforce Site, the Maintenance page is displayed.
Tip To display a custom page when Salesforce servers are unavailable, use Experience Cloud sites. - Page Not Found Page—The page users see when trying to access a
page that can’t be found. You can use the action attribute on an
<apex:page>component to redirect the Page Not Found error page. Using this kind of redirect on any other error pages will redirect users to the Maintenance page. - Generic Error Page—The page users see when encountering generic exceptions.
Note When using static resources in a custom error page—such as a large image file or a large CSS file contained in a static resource .zip file—each individual resource must be no larger than 50 KB. Otherwise, a 404 not found error is returned for that resource. - Save your changes.
-
To view the associated page as it appears in a browser, on the Site Details
page, click Preview.
Tip Add the<site:previewAsAdmin />component right before the closing</apex:page>tag in your custom Visualforce error pages to view detailed site error messages in administrator preview mode.For inactive sites, the default error page is the Under Construction page, and can’t be overridden using page assignments. You can override the default error page by assigning a simple HTML custom Visualforce page in the Inactive Site Home Page field.
What Happened to My Custom Error Page?
In certain circumstances, when you configure your site to display a custom error page, your site displays the standard Service Not Available page instead. This change happens by design when you switch to using the Salesforce content delivery network (CDN). This change also happens for sites that switch to using enhanced domains, because the Salesforce CDN is enabled by default for enhanced domains.
If you want to use a custom-branded error page, you have two options.
- Use Experience Builder to customize the standard Service Not Available page to fit your brand (recommended).
- Use your custom Visualforce error page by uploading it as a static resource. Make sure that the static resource contains all the resources your custom error page requires, and then select it under Workspaces | Administration | Pages | Service Not Available.
Interested in the technical details? When you enable the Salesforce CDN, your site traffic goes through our CDN partner. When our CDN partner receives 500, 502, 503, or 504 response codes from Salesforce, it responds with a 503 error code and displays the default Service Not Available page.

