Newer Version Available

This content describes an older version of this product. View Latest

MyDomainSettings

Represents your org’s My Domain settings. With My Domain, you can include your company name in your URLs, for example, https://yourcompanyname.my.salesforce.com. This type extends the Metadata metadata type and inherits its fullName field.

File Suffix and Directory Location

MyDomainSettings values are stored in a single file named MyDomain.settings in the settings directory. The .settings files are different from other named components because there’s only one settings file for each settings component.

Version

MyDomainSettings components are available in API version 47.0 and later.

Fields

Field Name Field Type Description
areLegacyRedirectsMaintained boolean Salesforce checks this field when this org is upgraded to Summer ’25. If areLegacyRedirectsMaintained is false, Salesforce disables enableLegacyRedirections during the upgrade. If true, no change is made to enableLegacyRedirections during the upgrade. The default is false.

This field has no impact after this org is on Summer ’25.

Available in API version 63.0 and later.

areLgcyRdirMaintainedWntr26 boolean Salesforce checks this field when this org is upgraded to Winter ’26. If areLgcyRdirMaintainedWntr26 is false, Salesforce disables enableLegacyRedirections during the upgrade. If true, no change is made to enableLegacyRedirections during the upgrade. The default is false.

This field has no impact after this org is on Winter ’26.

Available in API version 64.0 and later.

canOnlyLoginWithMyDomainUrl boolean If true, users must use the org's My Domain login URL to log in. If false (default), users can also log in using the org’s instance Salesforce URL, https://InstanceName.salesforce.com, and through the login URL https://login.salesforce.com.

Admins can log in to a sandbox via the Log In action on the Sandboxes Setup page only when canOnlyLoginWithMyDomainUrl is false in the sandbox.

doesApiLoginRequireOrgDomain boolean If true, users must use the org’s My Domain login URL to access the Salesforce API. If false (default), users can also access the Salesforce API using the generic Salesforce page, https://InstanceName.salesforce.com and through the login URL https://login.salesforce.com.
doesWarnOnForceComRedirect boolean Indicates whether users who visit a previous *.force.com site URL for this org see a message with the current URL during redirections (true) or not (false). The default is false.

This field is applicable only when

  • Your org has a previous *.force.com URL associated with an Experience Cloud site or Salesforce Site.
  • redirectForceComSitesUrls is true

This field is available in API version 59.0 and later.

doesWarnOnRedirect boolean Indicates whether users who visit a previous My Domain URL see a message with the current URL during redirections (true) or not (false). The default is false.

This field is applicable only when

  • Your org has a previous My Domain. For example, after an admin deploys a change to the My Domain.
  • The previous My Domain hasn’t been removed via the Routing options on the My Domain Setup page. If the previous My Domain is removed, calls to URLs associated with that My Domain aren’t redirected.
  • redirectPriorMyDomain is true.

This field is available in API version 59.0 and later.

domainPartition OrgDomainShard (enumeration of type string) The partition for this org. When none, partitioned domains aren’t enabled. Otherwise, My Domain hostnames include the partition value. For example, the format of a My Domain login hostname for a Developer Edition org with partitioned domains is MyDomainName.develop.my.salesforce.com.

This field is read-only in the API. Possible values are:

  • demo—Used in demo orgs. Available in API version 60.0 and later.
  • develop—Used in Developer Edition orgs. Also used in patch orgs where partitioned domains were deployed before Winter ’24.
  • free—Reserved for internal use.
  • none—Indicates that this org doesn’t use partitioned domains.
  • patch—Used in patch orgs. Available in API version 59.0 and later.
  • sandbox—Used in sandboxes with enhanced domains. These orgs are always partitioned.
  • scratch—Used in scratch orgs.
  • sfdctest—Reserved for internal use.
  • trailblaze—Used in Trailblazer Playgrounds.

Partitioned domains require enhanced domains. Production orgs always have a value of none, and only the sandbox partition is available in Government Cloud—Defense orgs.

Qualifying new orgs are partitioned by default and get the corresponding domainPartition value. You can’t disable this feature in those orgs.

Available in API version 55.0 and later.

edgeRoutingMethod edgeRoutingOption (enumeration of type string) If useEdge is true, the routing method for traffic for requests to this org. If useEdge is false, this field has no effect. The default is global.

Possible values are:

  • global—Route requests to the Salesforce Edge Network location closest to the origin of the request. This method provides the best performance and security.
  • regional—Route requests to Salesforce locations only in the country where your org is located.

    This routing method is only available in orgs on a Hyperforce instance in Japan.

    This routing method can result in increased round-trip time for requests, especially for users located outside of your country.

This field is read-only in the API. Update this setting on the My Domain Setup page.

Available in API version 65.0 and later.

enableCrossDomainPreviewCookies boolean If isFirstPartyCookieUseRequired is true, indicates whether cross-domain cookies are allowed on the Experience Builder preview domain (true) or not (false).

If isFirstPartyCookieUseRequired is false, this field has no effect.

Available in API version 62.0 and later.

enableEdgeDuringRollout boolean Indicates whether Salesforce Edge Network is enabled in this org during the scheduled rollout. If true, Salesforce notifies admins by email before Salesforce Edge Network is enabled. If false, the Edge enablement is deferred. The default value is true.

If useEdge is true, this field has no effect.

Available in API version 58.0 and later.

enableExtendedRedirections boolean If Salesforce configured temporary extended redirections for select legacy hostnames for this org, indicates whether calls to those hostnames are redirected (true) or not (false). The default is true. If extended redirections aren’t configured for this org, this field has no effect.

Available in API version 62.0 and later.

enableLegacyRedirections boolean If redirectPriorMyDomain is true, indicates whether legacy hostnames for this org are redirected (true) or not (false).

If any of these conditions are true, this field has no effect.

  • No legacy (non-enhanced) hostnames exist for the org
  • redirectPriorMyDomain is false
  • Salesforce stopped legacy redirections for this org

For more information about the end of legacy hostname redirections, see Prepare for the End of Redirections for Non-Enhanced Domains in Salesforce Help.

Available in API version 62.0 and later.

enableNativeBrowserForAuthOnAndroid boolean If true, use the native browser for authentication of Android mobile apps. Default is false.
enableNativeBrowserForAuthOnIos boolean If true, use the native browser for authentication of iOS mobile apps. Default is false.
instancedUrlRedirectHandling OrgDomainRedirectOption (enumeration of type string) Indicates how user visits to this org’s instanced URL are handled.

Possible values are:

  • Redirect—Redirect users to the equivalent page on this org’s My Domain hostnames.
  • WarnOnRedirect—Display a brief warning message to users as they are redirected to the equivalent page on this org’s My Domain hostnames.
  • NoRedirect—Require users to use your My Domain hostnames when they view this org’s pages. Visits to this page’s instanced URL aren’t redirected.

For example, when a user visits https://InstanceName.lightning.force.com/lightning/page/home, this setting determines whether they’re redirected to https://MyDomainName.lightning.force.com/lightning/page/home.

The value of this field has no effect on user’s ability to log in via the org’s instanced URL. To control that behavior, use canOnlyLoginWithMyDomainUrl.

Available in API version 59.0 and later.

isFirstPartyCookieUseRequired boolean Indicates whether the SameSite=None attribute is removed from Salesforce cookies (true) or not (false). In Salesforce orgs created in Summer ’24 and later, the default is true. In all other orgs, the default is false.

Service Cloud Voice with Amazon Connect and Service Cloud Voice with Partner Telephony from Amazon Connect aren’t compatible with this setting. If you use those features, set isFirstPartyCookieUseRequired to false. Learn more.

Available in API version 61.0 and later.

isIcorInstApiTrafficBlocked boolean This field is reserved for future use. The default is false.

Available in API version 64.0 and later.

logRedirections boolean If true, Salesforce produces a log for the Hostname Redirects event type when daily event logs are generated. The default is false.

The Hostname Redirects event is free for all customers with a 24-hour data retention period. When logRedirections is true, this event is available in the API but not in the Event Monitoring Analytics app. You can also download the latest Hostname Redirects event log file through a button on the My Domain page.

Available in API version 56.0 and later.

myDomainName string The subdomain name used in My Domain URLs for this org, such as MyDomainName.my.salesforce.com and MyDomainName.lightning.force.com.

This field is read-only in the API. You can change your org’s My Domain name from the My Domain Setup page.

Available in API version 51.0 and later.

myDomainSuffix OrgDomainProdSuffix (enumeration of type string) The domain suffix for this org’s My Domain login URL. This field is read-only in the API.

Possible values are:

  • CloudforceLimitedcloudforce.com
  • DatabaseLimiteddatabase.com
  • MySalesforcemy.salesforce.com with enhanced domains
  • MySalesforceLimitedmy.salesforce.com without enhanced domains
  • OrgLevelCertificatemy-salesforce.com
  • OrgLevelCertificateLimited—legacy version of my-salesforce.com that’s noncompliant with browser settings that block third-party cookies
  • Restricted1—Reserved for future use.
  • Restricted2—Reserved for future use.

Available in API version 51.0 and later.

onboardCustomerSpecificSuffix boolean This field is reserved for future use. The default is false.

Available in API version 63.0 and later.

redirectForceComSitesUrls boolean If true, calls to URLs ending in .force.com that serve your Experience Cloud sites and Salesforce Sites are redirected to the corresponding current My Domain site URL. If false, these calls aren’t redirected and the user gets a file not found (404) error. The default is true.

This field is only applicable when

  • Enhanced domains are enabled.
  • Your org has a previous *.force.com URL associated with an Experience Cloud site or Salesforce Site.

Available in API version 55.0 and later.

redirectPriorMyDomain boolean If true, calls to URLs associated with your previous My Domain name are redirected to the corresponding URL associated with your current My Domain. If false, these calls aren’t redirected. When you deploy a new My Domain, this setting resets to its default, true.

This field is only applicable when

  • Your org has a previous My Domain. For example, after an admin deploys a change to the My Domain.
  • The previous My Domain hasn’t been removed via the Routing options on the My Domain Setup page. If the previous My Domain is removed, calls to URLs associated with that My Domain aren’t redirected.

Available in API version 54.0 and later.

use3rdPartyCookieBlockingCompatibleHostnames boolean Indicates whether the org’s instance name is included in Visualforce URLs when third-party cookies are blocked (true) or not (false). This field has a default value of true. Setting this field true prevents potential issues loading Visualforce pages with stabilized URLs.

Only applicable when DatabaseLimiteduseStabilizedMyDomainHostnames is set to true and myDomainSuffix is set to

Available in API version 51.0 and later.

useEdge boolean

Indicates whether this org’s qualifying My Domain URLs are routed through Salesforce Edge Network (true) or not (false). This field has a default value of true.

This field is read-only in the API. If your org can use Salesforce Edge Network, you can enable this setting from the My Domain Setup page. After this field is set to true from Setup, it can't be set to false.

Available in API version 51.0 and later.

useEnhancedDomainsInSandbox boolean This field corresponds to the previous My Domain setting, Use enhanced domains by default in new and refreshed sandboxes, that was removed in Summer ’23.

Previously, in API versions 55.0 to 57.0, if enhanced domains weren’t enabled, this field indicated whether new and refreshed sandboxes created from this org used enhanced domains by default (true) or not (false), and the default value was true. As of API version 58.0, this field’s value is always true, regardless of the value that you set. Changing its value has no effect on Salesforce, even if it reads false.

useStabilizedMyDomainHostnames boolean Indicates whether the instance name is hidden in My Domain URLs for Visualforce, Experience Builder, Site.com Studio, and content files (true) or not (false). This field has a default value of true. For example, MyDomainName--PackageName.na44.visual.force.com becomes MyDomainName--PackageName.visualforce.com when this field is set to true.

Only applicable when DatabaseLimitedmyDomainSuffix is set to

useStabilizedSandboxMyDomainHostnames boolean This field corresponds to the Stabilize the Hostname for My Domain URLs in Sandboxes release update, which was enforced in Summer ’20.

When true, the instance name is hidden in My Domain URLs for sandboxes orgs. For example, MyDomainName--test.cs5.my.salesforce.com became MyDomainName--test.my.salesforce.com. As of API version 49.0, this field's value is always true, regardless of the value that you set. Changing its value has no effect on Salesforce, even if it reads false.

This change applies retroactively back to API version 47.0, when this field was first introduced. Previously, in API version 47.0 to 49.0, this field indicated whether the instance name was hidden in My Domain URLs for sandboxes orgs (true) or not (false), and the field's default value was false. Now, in all API versions, this field's value is always true, even if it reads false.

Declarative Metadata Sample Definition

The following is an example of a MyDomainSettings component.

1<?xml version="1.0" encoding="UTF-8"?>
2<MyDomainSettings xmlns="http://soap.sforce.com/2006/04/metadata">
3    <areLegacyRedirectsMaintained>false</areLegacyRedirectsMaintained>
4    <areLgcyRdirMaintainedWntr26>false</areLgcyRdirMaintainedWntr26>
5    <canOnlyLoginWithMyDomainUrl>false</canOnlyLoginWithMyDomainUrl>
6    <doesApiLoginRequireOrgDomain>false</doesApiLoginRequireOrgDomain>
7    <doesWarnOnForceComRedirect>false</doesWarnOnForceComRedirect>
8    <doesWarnOnRedirect>true</doesWarnOnRedirect>
9    <domainPartition>none</domainPartition>
10    <edgeRoutingMethod>global</edgeRoutingMethod>
11    <enableCrossDomainPreviewCookies>true</enableCrossDomainPreviewCookies>
12    <enableEdgeDuringRollout>true</enableEdgeDuringRollout>
13    <enableExtendedRedirections>false</enableExtendedRedirections>
14    <enableLegacyRedirections>false</enableLegacyRedirections>
15    <enableNativeBrowserForAuthOnAndroid>false</enableNativeBrowserForAuthOnAndroid>
16    <enableNativeBrowserForAuthOnIos>false</enableNativeBrowserForAuthOnIos>
17    <instancedUrlRedirectHandling>false</instancedUrlRedirectHandling>
18    <isFirstPartyCookieUseRequired>true</isFirstPartyCookieUseRequired>
19    <isIcorInstApiTrafficBlocked>true</isIcorInstApiTrafficBlocked>
20    <logRedirections>true</logRedirections>
21    <myDomainName>mycompany</myDomainName>
22    <myDomainSuffix>MySalesforce</myDomainSuffix>
23    <onboardCustomerSpecificSuffix>false</onboardCustomerSpecificSuffix>
24    <redirectForceComSitesUrls>true</redirectForceComSitesUrls>
25    <redirectPriorMyDomain>true</redirectPriorMyDomain>
26    <use3rdPartyCookieBlockingCompatibleHostnames>true</use3rdPartyCookieBlockingCompatibleHostnames>
27    <useEdge>true</useEdge>
28    <useEnhancedDomainsInSandbox>true</useEnhancedDomainsInSandbox>
29    <useStabilizedMyDomainHostnames>true</useStabilizedMyDomainHostnames>
30    <useStabilizedSandboxMyDomainHostnames>true</useStabilizedSandboxMyDomainHostnames>
31</MyDomainSettings>

The following is an example package.xml that references the previous definition.

1<?xml version="1.0" encoding="UTF-8"?>
2<Package xmlns="http://soap.sforce.com/2006/04/metadata">
3    <types>
4        <members>MyDomain</members>
5        <name>Settings</name>
6    </types>
7    <version>65.0</version>
8</Package>