Using WebDAV

Every Salesforce B2C Commerce instance has both an embedded WebDAV Server and a WebDAV Client.

The WebDAVClient class uses a server implemented on the merchant remote system. WebDAV uses either an HTTP or HTTPS connection. If you use WebDAV and HTTPS, you are PCI-compliant when transferring files to staging or production instances.

The WebDAV server resets the timestamp for a rename, copy, modify, or create operation to the time and date of the operation for uploaded files and directories.

For a sandbox instance, you can copy and paste files from a Windows machine into your cartridge. There is a WebDAV client integrated into the Windows operating system and a WebDAV server integrated into your cartridge.

When you use the WebDAV COPY command and try to copy a file’s content into itself, the destination is excluded because it exists (see the note below). The exclusion prevents a recursive infinite copy that fills the file system.

For example, an attempt to execute a recursive copy of the following structure:


             folder/path/content
             folder/path/content/c1
             folder/path/content/c2
             
             cp folder/path/content --> folder/path/content/targetfolder  
        

Resluts in:


             folder/path/content
             folder/path/content/c1
             folder/path/content/c2
             folder/path/content/targetfolder/c1
             folder/path/content/targetfolder/c2
        

In the example, targetfolder doesn’t exist in the destination folder (as it would be recursively the case).

Note: If a folder of the same name as the destination folder already exists in the source, nothing will be copied and no error is shown. This differs from https://datatracker.ietf.org/doc/html/rfc4918RFC 4918 webDAV standard where a recursive copy is done as long as it is possible at the source system.

B2C Commerce WebDAV Server and B2C Commerce WebDAV Client Do Not Communicate

You can connect to either the WebDAV client or the WebDAV server from any computer wherever WebDAV is installed, except from a B2C Commerce instance. The B2C Commerce WebDAV client can't connect to the B2C Commerce WebDAV server in its own instance or other instances.

WebDAV directories

B2C Commerce offers secure access to certain file system locations via WebDAV. For example:

Cartridges https://<domain>/on/demandware.servlet/webdav/Sites/Cartridges

Log files https://<domain>/on/demandware.servlet/webdav/Sites/Logs

Security Log files https://<domain>/on/demandware.servlet/webdav/Sites/Securitylogs

Import/Export https://<domain>/on/demandware.servlet/webdav/Sites/Impex

Troubleshooting

When attempting to access these locations, you could receive an "Access Denied" error. These WebDAV locations enforce an SSL connection to ensure that the transfer of your files is secure. Your storefront code, and import files such as orders or customer data, should never be transferred openly without encryption. When you attempt to connect to these locations unencrypted (http), the B2C Commerce application denies you access. If you are trying to access the WebDAV locations via a browser, remember to use HTTPS in your URL, which uses SSL and is secure. If you are attempting to connect via a WebDAV client such as Total Commander, remember to select the SSL option when setting up the connection.