cancel
Showing results for 
Search instead for 
Did you mean: 

Getting rid of /alfresco/webdav in my path? [Not Solved]

winston
Champ in-the-making
Champ in-the-making
Hi Alfresco Community,

I have a bit of a problem here.
I have an instance of Alfresco running with webdav, works really well. However, the webdav url looks like this:

http://server.stadiumarchitects.com/alfresco/webdav/stadiumarchitects/

I need it to look like this: Note I want the /alfresco/webdav part dropped.

http://server.stadiumarchitects.com/stadiumarchitects/

I have tried with mod_rewrite and mod_proxy but it seems that it's an Alfresco issue? Can anyone please tell me how do I get rid of /alfresco/webdav  ?

Your help is greatly appreciated!
7 REPLIES 7

winston
Champ in-the-making
Champ in-the-making
Hey Guys,

I have done the following to [attempt] to solve my problem, and I am seeing very interesting behavior.

I have added the following to my Vhost.conf


#First we add some protection.
ProxyRequests Off

#Then we define the url's to be proxied
ProxyPass ^/stadiumarchitects$ http://www.stadiumarchitects.com:8080/alfresco/webdav/stadiumarchitects/
ProxyPassReverse ^/stadiumarchitects$ http://www.stadiumarchitects.com:8080/alfresco/webdav/stadiumarchitects/
ProxyPass /stadiumarchitects/ http://www.stadiumarchitects.com:8080/alfresco/webdav/stadiumarchitects/
ProxyPassReverse /stadiumarchitects/ http://www.stadiumarchitects.com:8080/alfresco/webdav/stadiumarchitects/

#Now that we have defined our proxy we can redirect url's through it
RedirectMatch ^/stadiumarchitects$ http://www.stadiumarchitects.com/alfresco/webdav/stadiumarchitects/
RedirectMatch ^/stadiumarchitects/ http://www.stadiumarchitects.com/alfresco/webdav/stadiumarchitects/

#Now we add the mod_rewrite stuff
RewriteEngine On
       
Rewritecond %{REQUEST_URI} (stadiumarchitects|greenpoint)
RewriteRule ^/alfresco/webdav/(.*) /$1 [R=301,L,P]
RewriteLog "/var/log/apache2/www.stadiumarchitects.com_rewrite.log"
#Note I am using debug log level to see what is happening, for production we set this to 1
RewriteLogLevel 3

#Now we make sure that all our requests will be valid.
<Location /stadiumarchitects/>
<Limit OPTIONS PROPFIND GET REPORT MKACTIVITY PROPPATCH PUT CHECKOUT MKCOL MOVE COPY DELETE LOCK UNLOCK MERGE>
        Order Deny,Allow
        Allow from all
        Satisfy Any
        </Limit>
</Location>

OK.

Now that we have added all of the above to our Vhost.conf we can begin to investigate this.

SO. We fireup our VMWARE and start up windows.
Open up Internet explorer. Click File -> Open - and type the URL. In this case it's

http://www.stadiumarchitects.com/stadiumarchitects/
Remember to Tick "Open as a webfolder" so that we request DAV
Now, I see the following in my LOGS

The Landing URL shows me what I want to acomplish

http://www.stadiumarchitects.com/stadiumarchitects/

I can also see all my folders.

My apache ACCESS LOG has this information:


*.*.*.* - - [29/Apr/2007:15:46:36 +0200] "PROPFIND /stadiumarchitects HTTP/1.1" 302 251 "-" "Microsoft Data Access Internet Publishing Provider DAV"
*.*.*.* - - [29/Apr/2007:15:46:36 +0200] "PROPFIND /stadiumarchitects HTTP/1.1" 302 251 "-" "Microsoft Data Access Internet Publishing Provider DAV"
127.0.0.1 - - [29/Apr/2007:15:46:36 +0200] "PROPFIND /stadiumarchitects/ HTTP/1.1" 207 5531 "-" "Microsoft Data Access Internet Publishing Provider DAV"
*.*.*.* - - [29/Apr/2007:15:46:36 +0200] "PROPFIND /alfresco/webdav/stadiumarchitects/ HTTP/1.1" 207 5531 "-" "Microsoft Data Access Internet Publishing Provider DAV"

Note: I see again, the "/alfresco/webdav" - I don't want to see this.

MOD_REWRITE has this to say.


*.*.*.* - - [29/Apr/2007:15:46:36 +0200] [www.stadiumarchitects.com/sid#8191840][rid#833c128/initial] (2) init rewrite engine with requested uri /stadiumarchitects
*.*.*.* - - [29/Apr/2007:15:46:36 +0200] [www.stadiumarchitects.com/sid#8191840][rid#833c128/initial] (3) applying pattern '^/alfresco/webdav/(.*)' to uri '/stadiumarchitects'
*.*.*.* - - [29/Apr/2007:15:46:36 +0200] [www.stadiumarchitects.com/sid#8191840][rid#833c128/initial] (1) pass through /stadiumarchitects
*.*.*.* - - [29/Apr/2007:15:46:36 +0200] [www.stadiumarchitects.com/sid#8191840][rid#833c128/initial] (2) init rewrite engine with requested uri /stadiumarchitects
*.*.*.* - - [29/Apr/2007:15:46:36 +0200] [www.stadiumarchitects.com/sid#8191840][rid#833c128/initial] (3) applying pattern '^/alfresco/webdav/(.*)' to uri '/stadiumarchitects'
*.*.*.* - - [29/Apr/2007:15:46:36 +0200] [www.stadiumarchitects.com/sid#8191840][rid#833c128/initial] (1) pass through /stadiumarchitects
*.*.*.* - - [29/Apr/2007:15:46:36 +0200] [www.stadiumarchitects.com/sid#8191840][rid#833c128/initial] (2) init rewrite engine with requested uri /alfresco/webdav/stadiumarchitects/
*.*.*.* - - [29/Apr/2007:15:46:36 +0200] [www.stadiumarchitects.com/sid#8191840][rid#833c128/initial] (3) applying pattern '^/alfresco/webdav/(.*)' to uri '/alfresco/webdav/stadiumarchitects/'
*.*.*.* - - [29/Apr/2007:15:46:36 +0200] [www.stadiumarchitects.com/sid#8191840][rid#833c128/initial] (2) rewrite /alfresco/webdav/stadiumarchitects/ -> /stadiumarchitects/
*.*.*.* - - [29/Apr/2007:15:46:36 +0200] [www.stadiumarchitects.com/sid#8191840][rid#833c128/initial] (2) forcing proxy-throughput with http://www.stadiumarchitects.com/stadiumarchitects/
*.*.*.* - - [29/Apr/2007:15:46:36 +0200] [www.stadiumarchitects.com/sid#8191840][rid#833c128/initial] (1) go-ahead with proxy request proxy:http://www.stadiumarchitects.com/stadiumarchitects/ [OK]

Now, I enter into a directory under my webdav directory and now I see the
/alfresco/webdav in my url again Smiley Sad BAD!


http://www.stadiumarchitects.com/alfresco/webdav/stadiumarchitects/consultants

Apache ACCESS LOG has this to say:

127.0.0.1 - - [29/Apr/2007:15:51:38 +0200] "PROPFIND /stadiumarchitects/consultants HTTP/1.1" 207 11325 "-" "Microsoft Data Access Internet Publishing Provider DAV"
*.*.*.* - - [29/Apr/2007:15:51:38 +0200] "PROPFIND /alfresco/webdav/stadiumarchitects/consultants HTTP/1.1" 207 11325 "-" "Microsoft Data Access Internet Publishing Provider DAV"

MOD_REWRITE LOG has this to say:


*.*.*.* - - [29/Apr/2007:15:51:38 +0200] [www.stadiumarchitects.com/sid#8191840][rid#833c128/initial] (2) init rewrite engine with requested uri /alfresco/webdav/stadiumarchitects/consultants
*.*.*.* - - [29/Apr/2007:15:51:38 +0200] [www.stadiumarchitects.com/sid#8191840][rid#833c128/initial] (3) applying pattern '^/alfresco/webdav/(.*)' to uri '/alfresco/webdav/stadiumarchitects/consultants'
*.*.*.* - - [29/Apr/2007:15:51:38 +0200] [www.stadiumarchitects.com/sid#8191840][rid#833c128/initial] (2) rewrite /alfresco/webdav/stadiumarchitects/consultants -> /stadiumarchitects/consultants
*.*.*.* - - [29/Apr/2007:15:51:38 +0200] [www.stadiumarchitects.com/sid#8191840][rid#833c128/initial] (2) forcing proxy-throughput with http://www.stadiumarchitects.com/stadiumarchitects/consultants
*.*.*.* - - [29/Apr/2007:15:51:38 +0200] [www.stadiumarchitects.com/sid#8191840][rid#833c128/initial] (1) go-ahead with proxy request proxy:http://www.stadiumarchitects.com/stadiumarchitects/consultants [OK]
*.*.*.* - - [29/Apr/2007:15:51:38 +0200] [www.stadiumarchitects.com/sid#8191840][rid#8342140/initial] (2) init rewrite engine with requested uri /alfresco/webdav/stadiumarchitects/consultants
*.*.*.* - - [29/Apr/2007:15:51:38 +0200] [www.stadiumarchitects.com/sid#8191840][rid#8342140/initial] (3) applying pattern '^/alfresco/webdav/(.*)' to uri '/alfresco/webdav/stadiumarchitects/consultants'
*.*.*.* - - [29/Apr/2007:15:51:38 +0200] [www.stadiumarchitects.com/sid#8191840][rid#8342140/initial] (2) rewrite /alfresco/webdav/stadiumarchitects/consultants -> /stadiumarchitects/consultants
*.*.*.* - - [29/Apr/2007:15:51:38 +0200] [www.stadiumarchitects.com/sid#8191840][rid#8342140/initial] (2) forcing proxy-throughput with http://www.stadiumarchitects.com/stadiumarchitects/consultants
*.*.*.* - - [29/Apr/2007:15:51:38 +0200] [www.stadiumarchitects.com/sid#8191840][rid#8342140/initial] (1) go-ahead with proxy request proxy:http://www.stadiumarchitects.com/stadiumarchitects/consultants [OK]

NOTE: MOD_REWRITE LOG states that the URL is being *fixed* and the /alfresco/webdav string is removed.

Well, this is where I am so far. I will continue to investigate.
If you have any help you can offer me I will be most greatful.

Thank you,

winston
Champ in-the-making
Champ in-the-making
Good morning Alfresco Engineers,

Any advice that you can provide on my issue, which is removing /alfresco/webdav from my path?

This project has already started so these posts are put together with a certain sense of urgency.

Thanks guys,

Winston

jcox
Champ in-the-making
Champ in-the-making
Winston,

I'm in a tight development cycle at the moment,
so I cannot go over your config file in any detail
right now.    As you've probably realized already,
mod_rewrite is trickier than it looks at first, second,
and third glance.

Here's an answer to what I know is a totally different question,
but does contain a bunch of comments about rewriting that may
be helpful regardless:  http://issues.alfresco.com/browse/WCM-128

Here's a direct but sloppy answer to your post
(which, unfortunately, I've only had time to skim):
If you're trying to set up a reverse proxy so that
the browser sees one thing, but the origin server
gets another, you've got to be careful about where
and how you do your redirects, and what you declare
to be the last rule in a chain.    Also pay close attention
to the convoluted and counter-intuitive order that
mod_rewrite uses to do its processing  (this will probably
require re-reading the docs a few times).  It's hard to
stress enough that all is not as it seems with mod_rewrite.
There are some cookbook examples you can find online
via google – for something like this, you can probably
locate exactly what you want.

   I hope this helps,
  - Jon

Aside:
Have you considered using Alfresco's  WCM package
for your web-related stuff?  It's probably much more
suited to what you're doing if it's web-related.

winston
Champ in-the-making
Champ in-the-making
Hi Jon,

Man, you sure have a lot of knowledge with apache and mod re-write!
Just looking at your posts was confusing Smiley Happy

Jon, to get back to my request.
What bothers me, is the fact that, in my logs, I can see that mod_rewrite is doing it's stuff. I can see the URL being chewed up and replaced with the URL as I want it.

It doesn't seem to work though Smiley Sad

Jon, to be quite honest, I am a little disappointed that it's such a shlep to get such a simple thing done.
To be quite frank, I have ran out of time too…I simply cannot spend more time searching for a fix to a problem that should have been easily fixed in the first place. I guess no one needed this functionality before…

I am going to tell the guys that it cannot be done with out a prayer and a million bucks.
This means of course that these poor folks will have to change an XREF path in about 4000-5000 drawings…

Let's hope the guys focus on this issue with the next release and try to document some form of instructions on how to do this.

Thanks for the update though,
All the best,

Winston Nolan

kgilpin
Champ in-the-making
Champ in-the-making
The reason it's not working is that there are path names in the XML responses. For example, when the WebDAV client does a PROPFIND on a directory, there are elements such as this one:


  <D:href>/alfresco/webdav/other/path/info</D:href>

I am not an expert, but I assume that the WebDAV client is using this path to make future requests.

In order to hide your webdav server you would need to search/replace these paths.

openpj
Elite Collaborator
Elite Collaborator
To solve this problem you should override the GetMethod java class of the WebDAV implementation of Alfresco, this class is included in the Alfresco Remote API project and below you can see the full package of this class:
org.alfresco.repo.webdav.GetMethod
The method that you have to override is the following:
private void generateDirectoryListing(FileInfo fileInfo)



    // Get the URL for the root path
    String rootURL = WebDAV.getURLForPath(m_request, getPath(), true);
    rootURL = StringUtils.replace(rootURL,"alfresco/webdav","yourContextPath/webdav");


You only need to replace the string part of the URL that is involved for the context path of the Alfresco web application.
In this way all the links generated by the WebDAV servlet for contents are now overrided with your own contextPath that you have configured in your web server.

Hope this helps.

sebgymn
Champ in-the-making
Champ in-the-making
A different workaround will be to create a servlet that basically intercepts every request running at http://server/servlet/a_folder and invisibly redirects you to http://server/alfresco/webdav/a_folder.