Fixed  Save via WebDAV triggers '500 internal server error

TrevC

Well-known member
Hello,

I'm a bit stumped on this one.

Multiple fresh installs tested on both MAMP Pro locally and a LAMP VPS. Saving any file via WebDAV with Coda or Cyberduck triggers a '500 internal server error'. Transmit doesn't return an error, but corrupts the file you're editing and the same within the default style.

Xenforo error log doesn't have anything, apache error log is also empty. Apache access log shows:

Code:
subdomain.domainname.net:80 121.50.216.2 - trev [04/Mar/2011:14:03:03 +1000] "PUT /admindav.php/Public_Templates/teststyle%20(2)/account_following.html HTTP/1.1" 500 591 "-" "WebDAVFS/1.2.7 (01278000) Coda/1.7 neon/0.26.0"

I've disabled xcache on the VPS, checked directory permissions (everything is 0755, except for data/internal_data which are at 0777). .htaccess is not currently in use on the forum .

Any ideas or suggestions would be greatly appreciated.

Is there any option available to run a Xenforo theme from files instead of the DB (even if just for design purposes)? It would be nice to eliminate the extra WebDAV layer of complexity. The requirement for WebDAV is so far the only aspect of Xenforo I really dislike. Why do I need debug mode enabled + extra config steps and protocols just to efficiently work on a theme?

Everything else is excellent and has exceeded all expectations :)
 
Debugging WebDAV is unfortunately a nightmare - there will actually be more details to that error in the response, but it's never shown. The only (consistent) way I've found to get more info from the error is via Wireshark.

Note that the WebDAV approach is mostly unsupported - it doesn't work with every WebDAV client and it may require some particular server configuration. The official method is via the admin CP. Unfortunately, templates as individual files isn't something that is really feasible with our styling scheme, template syntax, and metadata.
 
There's no webdav-error.log unfortunately. Thanks for the Wireshark suggestion.

Are there any future plans for an alternative to the WebDAV access method?

Xenforo is an awesome, modern platform that deserves high-end themes. I don't think there's going to be a very diverse selection if WebDAV (which is a nightmare to debug) and the admin CP are the only access methods. Obviously no designer will want to be stuck working in the admin textarea with single files. Please at least consider offering a more user-friendly alternative.

I've tried Transmit/Cyberduck/Coda for clients, and 2 servers running different operatings systems in a selection of varying software configurations. No go. If Xenforo wasn't the best platform (IMO), I would've given up and moved on a while ago.

I'm really interested in finding out what's happening here. Hope Wireshark can sniff it out! :)
 
I used tcpdump to capture the error server-side. Here's what it shows for two saves to different files:

Code:
PUT /admindav.php/Public_Templates/omegastyle%20(2)/account_contact_details.html HTTP/1.1
Host: name
User-Agent: WebDAVFS/1.2.7 (01278000) Coda/1.7 neon/0.26.0
Connection: TE
TE: trailers
Content-Length: 5476

---- template code was here ----

HTTP/1.1 500 Internal Server Error
Date: Fri, 04 Mar 2011 15:30:28 GMT
Server: Apache
Content-Length: 414
Connection: close
Content-Type: application/xml; charset=utf-8

<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://www.rooftopsolutions.nl/NS/sabredav">
  <s:exception>ErrorException</s:exception>
  <s:message>Undefined variable: addOnId</s:message>
  <s:file>/var/www/name/library/XenForo/SabreDav/File/Template.php</s:file>
  <s:line>132</s:line>
  <s:code>0</s:code>
  <s:sabredav-version>1.0.14</s:sabredav-version>
</d:error>

Code:
PUT /admindav.php/Public_Templates/omegastyle%20(2)/account_likes.html HTTP/1.1
Host: name
User-Agent: WebDAVFS/1.2.7 (01278000) Coda/1.7 neon/0.26.0
Connection: TE
TE: trailers
Content-Length: 789

---- template code was here ----

HTTP/1.1 500 Internal Server Error
Date: Fri, 04 Mar 2011 15:30:34 GMT
Server: Apache
Content-Length: 414
Connection: close
Content-Type: application/xml; charset=utf-8

<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://www.rooftopsolutions.nl/NS/sabredav">
  <s:exception>ErrorException</s:exception>
  <s:message>Undefined variable: addOnId</s:message>
  <s:file>/var/www/name/library/XenForo/SabreDav/File/Template.php</s:file>
  <s:line>132</s:line>
  <s:code>0</s:code>
  <s:sabredav-version>1.0.14</s:sabredav-version>
</d:error>
 
Argh, there's a typo on line 122 ($addonId -> $addOnId) of library/XenForo/SabreDav/File/Template.php.
 
No problem. Frustrating, but I'm happy it's sorted out.

Strange how Transmit still did (appear to) save the file, which caused all styles to be corrupted. Only Coda/Cyberduck bounced back with the 500.
 
Transmit has a status slide out that i always have open to keep an eye on. I wish FlashFXP would support SFTP and was actually a Mac program :p that program never failed me on windows.
 
I've decided to link to a stylesheet directly from PAGE_CONTAINER.html
I use Firebug to identify page elements, then style them externally. I'll eventually merge this with the default Xenforo CSS and keep them in the same external stylesheet.

I'm not a fan of the WebDAV/debug-mode access method at all (I can only use Coda or Cyberduck reliably). I hope someone builds an add-on to manipulate templates from the file system. I'd happily pay for it.
 
Popular content management systems do both.

ExpressionEngine has extensive support for this type of editing (and syncing back to the DB if/when needed)
Toggle an option, re-save the template, and it's available as a file which EE will read and cache. EE is only one example.

Obviously designers won't be using the admin CP interface when fully re-skinning the forum. WebDAV is "mostly unsupported", delicate (Transmit corrupting Xenforo with one file-save), and requires debug-mode. So, what does that leave?
 
No problem. Frustrating, but I'm happy it's sorted out.

Strange how Transmit still did (appear to) save the file, which caused all styles to be corrupted. Only Coda/Cyberduck bounced back with the 500.

I'm glad that you managed to get it sorted after the other night nightmare!
 
Upgraded to 1.0.0. Re-enabled debug mode, now I'm receiving 500's on saving files.

This is exactly why I believe WebDAV is a very poor choice for accessing templates. As an end-user, I don't even receive an actual error message. It could be a config issue, Apache, a typo in one of your variables, anything...

I'll need to log via tcpdump and see what's actually happening. What would a user do if they were on shared-hosting or similar?
 
Top Bottom