Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am aware that if you set the svn:mime-type Subversion property on a .html file to text/html then when viewing the file in a browser through the Subversion module in Apache httpd it will be served with a Content-Type: text/html header, enabling the browser to render it as HTML rather than plain text.

However, I am looking for a way to do this without using the svn:mime-type property.

I'm aware that you can configure your svn client to automatically add the property - this is not what I want, as I do not want to ensure all users have these settings. I'm also aware that I could create a pre-commit hook that rejects the commit if the properties are not set, in order to force users to set the property - I might fall back to that, but I'm looking for something less intrusive.

I'm also aware that I could use a post-commit hook to add the properties automatically on the server-side. I'd rather not do that (as users then have to update immediately after their commit, and it's not trivial to write) - I'm looking for a better alternative. Perhaps something with rewrite rules in the Apache server?

share|improve this question

1 Answer 1

Short answer - yes - set ModMimeUsePathInfo to on to make Apache responsible for the MIME types.

Longer answer - yes but you need to be using a relatively modern version of Subversion within your Apache server.

Normally the content is being served by the mod_dav_svn module which is interrogating the Subversion repository, therefore the mime-type would be specified by the Subversion module.

Historically this was only able to be configured using the svn:mime-type property. See this thread on the Subversion User's mailing list for an example of someone attempting to perform something similar.

Now, using the ModMimeUsePathInfo directive will tell Apache to figure out what MIME type to specify using mod_mime - see Appendix C, WebDAV and Autoversioning of the Subversion book for more info.

Specifically something like:

<Location /repos>
    DAV svn
    SVNPath /var/svn/repository
    SVNAutoversioning on

    ModMimeUsePathInfo on
</Location>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.