workaround for apache webdav

359 views
Skip to first unread message

arg...@gmail.com

unread,
Mar 15, 2019, 7:18:52 PM3/15/19
to TiddlyWiki
I've been trying for awhile to get TiddlyWiki to work with apache webdav.

After reading what was said in this group it appeared that the problem where etags, so i deactivated them by using the "FileEtag None" directive at the webdav folder level.

It now work like a charm although I don't think it's the right way to resolve the situation...

Did someone managed to get webdav saves work under apache2 web servers in a more protocolar way ?

PMario

unread,
Mar 16, 2019, 9:46:52 AM3/16/19
to TiddlyWiki
Hi,

WebDav works fine with the latest PUT saver, if you disable server side compression.

I did create a proof of concept using the last-modified header attribute. It basically works in the same way as etags, but also allows you to compress the wiki over the wire.

My implementation replaces the existing saver, which is part of the core. ... I'd need to test, if it's possible to work as a plugin.

have fun!
mario

PMario

unread,
Mar 16, 2019, 9:47:30 AM3/16/19
to TiddlyWiki
Hi,

Do you use WebDav in a local setup, or is it exposed to the web?

-m

arg...@gmail.com

unread,
Mar 16, 2019, 12:01:26 PM3/16/19
to TiddlyWiki
Hi Mario,

Thanks for the answers. I use tiddlywiki exposed to the web.

PMario

unread,
Mar 18, 2019, 9:05:28 AM3/18/19
to TiddlyWiki
Hi,

Did you try to disable server side compression, AND did it work out?

I want to upload a new plugin later today. .. I can PM you an experimental version, if you want to test and give feedback.

have fun!
mario

Lost Admin

unread,
Mar 18, 2019, 11:32:41 AM3/18/19
to TiddlyWiki
I use Apache with WebDav for my TiddlyWiki server. Https and basic auth both enabled. My config, with explanation is here: http://thelostadmin.tiddlyspot.com/#Apache%20HTTPD%20with%20WebDAV

If it's not working, let me know what is wrong and I'll double-check my current actual config.

PMario

unread,
Mar 19, 2019, 6:41:38 AM3/19/19
to TiddlyWiki
Hi folks,


It would be nice to get feedback.

I did test it with IIS and FF.

have fun!
mario

Lost Admin

unread,
Mar 19, 2019, 8:42:43 AM3/19/19
to TiddlyWiki
I wonder if that is going to make it into the core saver if/when it is determined to be stable. I would happily add compression to my WebDav sites at that point.

PMario

unread,
Mar 19, 2019, 10:27:46 AM3/19/19
to TiddlyWiki
On Tuesday, March 19, 2019 at 1:42:43 PM UTC+1, Lost Admin wrote:
I wonder if that is going to make it into the core saver if/when it is determined to be stable. I would happily add compression to my WebDav sites at that point.

Hi,

It would be nice, if you could test it with your setup. ... and give feedback :)

It uses the exact same "program flow" as the existing etag version (since TW V5.1.17).

The problem with etags seem to be "vendor related". As we fixed a bug in the etag handling, we found out, that every vendor (apache, nginx, IIS) seem to have a different opinion, how etags should be calculated. ... All of them had the "compression problem".

have fun!
mario

PMario

unread,
Mar 19, 2019, 10:28:34 AM3/19/19
to TiddlyWiki

Lost Admin

unread,
Mar 19, 2019, 11:47:17 AM3/19/19
to TiddlyWiki


On Tuesday, March 19, 2019 at 10:27:46 AM UTC-4, PMario wrote:
On Tuesday, March 19, 2019 at 1:42:43 PM UTC+1, Lost Admin wrote:
I wonder if that is going to make it into the core saver if/when it is determined to be stable. I would happily add compression to my WebDav sites at that point.

Hi,

It would be nice, if you could test it with your setup. ... and give feedback :)

I will be testing it on my setup. I only learned it existed today.

Daimon Eu

unread,
Nov 12, 2019, 5:00:20 AM11/12/19
to TiddlyWiki


On Saturday, March 16, 2019 at 12:18:52 AM UTC+1, arg...@gmail.com wrote:

Did someone managed to get webdav saves work under apache2 web servers in a more protocolar way ?


This configuration is working for me on Apache 2.4 (Raspbian):
.
<Location /dav/doc>
           RequestHeader edit "If-Match" '^"((.*)-(gzip|br))"$' '"$1", "$2"'
           DAV On
           AuthType Basic
           AuthName "webdav"
           AuthUserFile /var/www/passwd.dav
           Require valid-user
</Location>

The first line solves the problem of Etags not working when server side compression is enabled. It's an adaptation of this: https://bz.apache.org/bugzilla/show_bug.cgi?id=45023#c26

As I detailed in the topic by PMario, his alternative saver does not work for me.

Hope this can be useful.

Cheers.

PMario

unread,
Nov 12, 2019, 6:13:30 AM11/12/19
to TiddlyWiki
On Tuesday, November 12, 2019 at 11:00:20 AM UTC+1, Daimon Eu wrote:
....
This configuration is working for me on Apache 2.4 (Raspbian):

So the default WebDav setting works for you, _with_ gzip compression enabled?

The first line solves the problem of Etags not working when server side compression is enabled. It's an adaptation of this: https://bz.apache.org/bugzilla/show_bug.cgi?id=45023#c26

Thx for doing the research and sharing the "bug-link" it is very interesting and contains a lot of information about the underlying problems.

-m

Daimon Eu

unread,
Nov 13, 2019, 1:52:30 PM11/13/19
to TiddlyWiki
Yes it's working with gzip! I've also tried this client-side workaround:

            self.etag = etag.replace(/^W\//,"");
     
->     self.etag = self.etag.replace(/-gzip/,"");

I've added the second line to $:/core/modules/savers/put.js and the effect is the same as modifying the server conf.

It should work on other versions of Apache too, it looks like the bug hasn't been fixed yet even if it's 12 years old and counting.

Cheers

PMario

unread,
Nov 13, 2019, 3:20:45 PM11/13/19
to TiddlyWiki
On Wednesday, November 13, 2019 at 7:52:30 PM UTC+1, Daimon Eu wrote:
Yes it's working with gzip! I've also tried this client-side workaround:

            self.etag = etag.replace(/^W\//,"");
     
->     self.etag = self.etag.replace(/-gzip/,"");

I've added the second line to $:/core/modules/savers/put.js and the effect is the same as modifying the server conf.

hihi, ... yea, "workarounds" all over the place. If you have a look at the "code blame" view and follow the merged PRs + their links at github, you'll see, how quirky the etag handling is. .. It seems every server does it a "tiny" bit different. ... Which causes us weird problems.

As far as I can remember IIS doesn't add the "-gzip" string. It somehow uses 2 different etags ... BUT from the bugzilla link you posted, I did learn, that there could be more than 1 etag listed in the header. ... so there may be a new vector to fix the stuff. ....

More tests would be needed.
 
It should work on other versions of Apache too, it looks like the bug hasn't been fixed yet even if it's 12 years old and counting.

The problem is, that it also needs to work with other servers, like IIS and nginx. ... As I wrote, I'll have to test again using some docker images for apache and nginx. ... If I can find them again :/

Anyway. ... Thx for your feedback and your "server side" workaround. I'm sure it will help others. ... And if it leads to better client side code, even better

have fun!
mario
Reply all
Reply to author
Forward
0 new messages