The Server.app manages WebDAV shares and recreates the configuration files each time the File Server is restarted.

The only way I've found to customise the configuration is to prevent the Server.app from writing over the generated files once you have customised them.

Enable Infinite Depth Queries

  • Add a share and enable the option "Share with iOS devices (WebDAV)"
  • This will create a file in the apache configuration folders for any of the shares you have enabled.
  • The location of the file is
    /Library/Server/Web/Config/apache2/httpd_webdavsharing_sharepoints.conf
  • This file is typically recreated each time you restart the File Sharing option or when you change your shared folders
  • A typical configuration may look like the following
    # This file is auto-generated by the web configuration
    # mechanism whenever WebDAV Sharing settings are modified.
    
    # Updated: 2013-03-07 04:32:07 +0000
    
    <Directory "/Data">
     Allow from 127.0.0.1
     DAV On
     DavDepthInfinity on
     AllowOverride None
    </Directory>
    RequestHeader edit Destination "^.*/Data(.*)$" "http://localhost:${UserPort}/Data$1"
    
    <Directory "${UserHomeDir}">
     Allow from 127.0.0.1
     DAV On
     AllowOverride None
    </Directory>
    RewriteRule ^/${UserUUID}/${UserName}(.*)$ "${UserHomeDir}$1" [NS]
    RequestHeader edit Destination "^.*/${UserName}(.*)$" "http://localhost:${UserPort}${UserHomeDir}$1"
    Substitute "s|${UserUUID}${UserHomeDir}|webdav/${UserName}|n"
    Substitute "s|${UserHomeDir}|/webdav/${UserName}|n"
    
  • In order to customise your share and enable options like "DavDepthInfinity on", you need to prevent the server from recreating the file
  • Edit the file to customise it as required.
  • Then prevent any further changes by running the following command on the file from the console
              chflags uchg httpd_webdavsharing_sharepoints.conf
          
  • You can now stop and start the File Sharing process without affecting your configuration
  • In order to change the file again you need to reverse the setting
              chflags nouchg httpd_webdavsharing_sharepoints.conf
          
  • Remember to reverse the setting when you want to make changes using the Server.app