
jacob at knossos
Aug 7, 2012, 6:04 PM
Post #1 of 1
(256 views)
Permalink
|
|
Apache ModRewrite vodo in .htaccess causing problem for davical URL shortning
|
|
This is more of a comment than anything, but I've encounter a problem with using URL shorting via the .htaccess mechanism in Davical. The Davical htdocs directory contains a .htaccess file with the following lines # RewriteEngine On # # Not if it's the root URL. You might want to comment this out if you # # want to use an explicit /index.php for getting to the admin pages. # RewriteCond %{REQUEST_URI} !^/$ # RewriteCond %{REQUEST_URI} !^/davical/$ # # Not if it explicitly specifies a .php program, stylesheet or image # RewriteCond %{REQUEST_URI} !\.(php|css|js|png|gif|jpg) # # Everything else gets rewritten to /caldav.php/... # RewriteRule ^(.*)$ /caldav.php$1 [NC,L] uncommenting these line should enable the rewrite rule in the last line to shorten caldav URLs to remove the 'caldav.php' reference, eg http://davical.example.com/caldav.php/user/calender shortens to http://davical.example.com/user/calender However, as the .htaccess is applied on a per directory basis the rule as it stands will not work, and should instead be: RewriteRule ^(.*)$ /caldav.php/$1 [NC,L] But alas.... Using the Thunderbird Lightning client (other Caldav clients I've tried appear to work ok) reveals an Apache anomaly which can be exposed through the following steps: 1. Add a Lightning caldav client with a short URL not containing 'caldav.php' 2. Add a new event in Lightning on the new calendar 3. Delete this event (or any other on the calendar) Lightning responds: An error occurred when writing to the calendar! Status Code: 404, Resource not found. Apaches logs show: "DELETE /user/calendar/calendar/89ebc301-a4c9-48f9-a08c-ed3c8baa6f14.ics HTTP/1.1" 404 - Note the duplicate '/calendar/calendar' in the request URL. If the original Apache RewriteRule is placed in the apache config file for the calendar server VirtualHost, rather then the per directory .htaccess, all is well. Some Apache discussion have reports of this problem or one similar to it possibly being addressed by flag on the RewriteRule named 'DPI' (Discard Path Info), but I've not had any success getting this to work on even current versions of Apache https://issues.apache.org/bugzilla/show_bug.cgi?id=38642 ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Davical-general mailing list Davical-general [at] lists https://lists.sourceforge.net/lists/listinfo/davical-general
|