Gallery2:Modules:webdav:admin - Gallery Codex
Personal tools

Gallery2:Modules:webdav:admin

From Gallery Codex

This document serves as documentation for the Gallery administrator to configure and troubleshoot the WebDAV module.

If you are looking for WebDAV client related instructions or for development documentation, please see:

Configuration

The WebDAV URL for each album in Gallery is displayed in the WebDAV URL block. To enable this block, in Site Admin, from Admin Options, select Themes.

Alternatively, you can automatically connect with the Mount with WebDAV item link.

Zeroconf

Lennart Poettering's Apache mod_dnssd can be used to publish Gallery and the Gallery WebDAV connection with multicast DNS / Zeroconf / DNSSD / Rendezvous / Bonjour: http://0pointer.de/lennart/projects/mod_dnssd/ http://packages.debian.org/libapache2-mod-dnssd

Add the following to your Apache config:

<IfModule mod_dnssd.c>
  <Location /gallery2>
    DNSSDServiceName "Gallery"
  </Location>

  <Location /gallery2/w>
    DNSSDServiceName "Gallery"
    DNSSDServiceTypes _webdav._tcp
  </Location>
</IfModule>

As a result, Gallery will appear in Safari's Bonjour menu, in the Mac OS X "Connect to Server..." dialog, in the Gnome service discovery applet, etc.

Troubleshooting

PHP has no XML support

More information about PHP XML support.

WebDAV requests not handled

Your web server doesn't pass one of the WebDAV HTTP request methods to Gallery:

  • PROPFIND
  • PROPPATCH
  • MKCOL
  • LOCK
  • UNLOCK

If your website runs on an Apache webserver, ensure that mod_dav is disabled for your website. See mod_dav.

HTTP auth module disabled

More information about the HTTP auth module.

mod_dav

mod_dav is not required. Dav must be disabled (remove Dav On from your httpd.conf).

'Connect to WebDAV' rule disabled

Most WebDAV clients don't support query strings. The 'Connect to WebDAV' URL rewrite rule generates short URLs without query strings.

Missing DAV headers

The WebDAV spec, RFC 2518, promises the DAV header on all OPTIONS responses:

This header indicates that the resource supports the DAV schema and protocol as specified.  All DAV compliant resources MUST return the DAV header on all OPTIONS responses.

The WebDAV module will return the DAV header on all responses, but some server configurations don't pass OPTIONS requests to scripts, e.g. Apache doesn't pass OPTIONS requests to CGI scripts: http://issues.apache.org/bugzilla/show_bug.cgi?id=37982

Alternatively, we can set DAV headers using Apache mod_headers and mod_rewrite. http://httpd.apache.org/docs/mod/mod_headers.html http://httpd.apache.org/docs/rewrite/

The mod_headers directives are in modules/webdav/data/options/.htaccess. The 'OPTIONS Requests' rewrite rule redirects OPTIONS requests to this directory.

Alternative URL missing DAV headers

If you are using Apache, you should check that mod_headers is enabled.

URL rewrite module disabled

The URL rewrite module is needed to automatically redirect OPTIONS requests so we can set DAV headers, and to generate short URLs without query strings.

Bad URL rewrite configuration

The WebDAV 'OPTIONS Requests' rule is only supported by the Apache mod_rewrite and ISAPI_Rewrite parser.

'OPTIONS Requests' rule disabled

Alternatively, if you use Apache mod_rewrite, you can manually add to your Gallery .htaccess file:

RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule .   /foo/gallery2/modules/webdav/data/options/   [QSA,L]

Native Windows WebDAV Client Can't Connect to Server

Problem:

If it seems as if the username/password is not accepted, you should check:

  • Is the webserver running Apache
  • And is Gallery in an Apache Alias folder (mod_alias)

In that case Apache won't redirect example.com/gallery2 to example.com/gallery2/ and the native Windows WebDAV client does exactly that request.

Solution:

Just cancel when the username/password is not accepted when adding Gallery as network resource and click next in the wizard. Once Gallery is added as network resource, authentication should finally work.

If not possible, like it was for me, just try to install a webdav client (like DataFreeway), then setup your connection in this client. Then connect. After that, try again with Native Windows WebDav Client... It should work.

mod_security & Apache notes

Tested under Apache 2.2.4 and mod_security 1.9.4 with URL Rewrite & HTTP Auth modules/plugins enabled. Client used was Windows XP "My Network Places"

Let's say you have a global (outside of any <Directory> or <VirtualHost> container) mod_security filter that deny requests other than GET, HEAD, and POST and return a "404 - file not found" (status:404) response.

SecFilterSelective REQUEST_METHOD "!^(GET|HEAD|POST)$" "id:1001,deny,log,status:404"

To bypass the filter and only allow it on a specific directory, add the following to your Apache config:

<Directory /path/to/gallery2/>
Options FollowSymLinks -Indexes -Includes -IncludesNOEXEC -ExecCGI
AllowOverride Options FileInfo AuthConfig
....
SecFilterRemove 1001
SecFilterSelective REQUEST_METHOD "!^(GET|HEAD|POST|PROPFIND|PROPPATCH|MKCOL|LOCK|UNLOCK|MOVE|PUT|OPTIONS|DELETE|USERNAME)$"
</Directory>

In the example given, "1001" ("id:1001,deny,log,status:404") is the ruleset ID assigned to the global filter. "SecFilterRemove 1001" disables the filter.

Save your changes, then restart Apache > login to Site Admin > Plugins > uninstall and reinstall the following plugin in the exact order:

- URL Rewrite, HTTP Auth then WebDav

start the Windows Explorer > browse into My Network Places > Add Network Place and paste the URL address provided by G2 to mount

Simple Checklist for MS Internet Explorer <-> Apache WebDav

As the above can be a little terse and disjointed...:

  • Enable Gallery2's URL Rewrite Plug-In / Apache's mod_rewrite (Implies a chmod 666 .htaccess in your /gallery2/ base directory)
  • Make sure mod_dav and mod_dav_fs are disabled in Apache (grep phpinfo()'s output for those Apache modules)
  • Enable Gallery2's HTTP Auth Plugin
  • Enable the WebDav Content Block in Gallery2's Themes (I'm using it on the Album Page)
  • Login to Gallery2 in Internet Explorer
  • Browse to your desired edit point in Internet Explorer
  • Click on 'Click here' to open the WebDav connection

WARNING : "maintenance mode" must be disabled !! This is not compatible ! (for rewrite rules reasons)

advertisements