[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: SVN files content Type

From: Ryan Schmidt <subversion-2011a_at_ryandesign.com>
Date: Mon, 16 May 2011 01:44:18 -0500

On May 16, 2011, at 00:42, D, Dinoj wrote:

> Hi Daniel/Ryan
>
> Thanks. I understood that the mime content-types are not sending to the
> client from the server's mime.types file , intead it takes from the
> files which have subversion mime-type property set. I am unable to
> configure this to bypass to apache mime.types file.

That's correct.

> Here my requirement
> is that whoever accessing the repository through web browser must get
> the mime content-type from the apache file conf/mime.types and not from
> the svn:property. Please help on this.

There's no way to configure Subversion to do that.

As I already suggested, consider having a server-side post-commit hook that updates a server-side working copy of a relevant part of your repository, and point your apache at that working copy. Then, when users want to access this site, instruct users to use that other URL, not the repository URL.

As a concrete example:

Consider you have an HTML page in a project in a repository accessible here:

http://www.example.com/svn/project1/trunk/folder/index.html

You haven't been using svn:mime-type, so users who view this URL in a web browser will see the source of the document, instead of the page rendered as HTML which is what you want.

Imagine your repository is on the server at /var/svn, and that you have a document root at /var/www used for everything at http://www.example.com/ other than the /svn directory, like this:

<VirtualHost *:80>
        ServerName www.example.com
        DocumentRoot /var/www
        <Location /svn>
                DAV svn
                SVNPath /var/svn
        </Location>
</VirtualHost

So, check out a working copy of this project's trunk somewhere inside the document root:

mkdir -p /var/www/test
cd /var/www/test
svn co http://www.example.com/svn/project1/trunk project1

Now you can access that same HTML file from above at:

http://www.example.com/test/project1/folder/index.html

And now it will use the MIME types from the Apache configuration.

Now, you install a post-commit hook script in the repository which basically does:

svn up /var/www/test/*

This way, every time anyone commits anything to the repository, the test directories will be updated as well.

Updating "*" will be slow, so you can optimize this further if you like to just update the thing that was just committed.
Received on 2011-05-16 08:44:59 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.