Thursday, February 8, 2024

[SOLVED] Shortening URL of VisualSVN Server breaks browser access to repository

Issue

I recently setup VisualSVN Server. Rather than have the server accessible at:

http://server/svn/repo/

I wanted to have it at a nicer URL:

http://server/repo/

To achieve this, I changed the Location parameter in C:\Program Files (x86)\VisualSVN Server\conf\httpd.conf from:

<Location /svn/>

to instead read:

<Location />

This works fine when using TortoiseSVN to access the repo, but viewing the repo with a browser is now broken. The webpage authenticates fine, but the browser only gets an empty page.

Windows Server event viewer shows this error when web browsing is attempted:

Failed to load the AuthzVisualSVNReposRelativeAccessFile:
Can't open file 'D:\\Repositories\\svnindex.xsl\\conf\\VisualSVN-WinAuthz.ini':
The system cannot find the path specified.

This seems to have something to do with the server looking in D:\Repositories\ rather than in C:\Program Files (x86)\VisualSVN Server\htdocs\ for authentication files.

Is there a way to have both the shortened URL and the repo accessible by browser?

If it helps, here is the httpd.conf file:

ThreadsPerChild 128
MaxMemFree 64
MaxRequestsPerChild  0
MaxKeepAliveRequests 2000
KeepAliveTimeout 5
Win32DisableAcceptEx
LimitXMLRequestBody 0
LimitRequestFieldSize 16384
SendBufferSize 131072

ServerRoot "C:/Program Files (x86)/VisualSVN Server"
ServerName "server.domain.local:80"
ServerSignature Off
ServerTokens Prod
DocumentRoot "htdocs"
FileETag MTime Size

PidFile "${TEMP}\VisualSVNServer.pid"

Listen "192.168.0.11:80"

LoadModule auth_basic_module bin/mod_auth_basic.so
LoadModule authn_file_module bin/mod_authn_file.so
LoadModule authn_visualsvn_module bin/mod_authn_visualsvn.so
LoadModule authz_visualsvn_module bin/mod_authz_visualsvn.so
LoadModule alias_module bin/mod_alias.so
LoadModule dir_module bin/mod_dir.so
LoadModule mime_module bin/mod_mime.so
LoadModule setenvif_module bin/mod_setenvif.so
LoadModule rewrite_module bin/mod_rewrite.so
LoadModule expires_module bin/mod_expires.so

LoadModule dav_module bin/mod_dav.so
LoadModule dav_svn_module bin/mod_dav_svn.so
    # LoadModule ssl_module bin/mod_ssl.so

<Directory />
  Options FollowSymLinks
  AllowOverride None

  RewriteEngine on
  RewriteCond %{REQUEST_URI} ^/svn$
  RewriteCond %{HTTP_USER_AGENT} !^SVN/
  RewriteRule ^(.*/svn)$ %0/ [R=301,L]
</Directory>

SVNInMemoryCacheSize 16384

<Location />
  DAV svn

  SVNListParentPath on
  SVNParentPath "D:/Repositories/"
  SVNIndexXSLT "/svnindex.xsl"

  SVNPathAuthz short_circuit

  SVNCacheTextDeltas off
  SVNCacheFullTexts off

  SVNAllowBulkUpdates prefer

  AuthName "VisualSVN Server"
  AuthType VisualSVN
  AuthzVisualSVNReposRelativeAccessFile "VisualSVN-WinAuthz.ini"
  AuthzVisualSVNGlobalAccessFile "D:/Repositories/VisualSVN-GlobalWinAuthz.ini"
  AuthnVisualSVNBasic on
  AuthnVisualSVNIntegrated off
  AuthnVisualSVNUPN On

  require valid-user

  # Add Expires/Cache-Control header explictly
  ExpiresActive on
  ExpiresDefault access
</Location>

BrowserMatch "(\s|^)neon/\d+.\d+.\d+(\s|$)" AuthnVisualSVNIgnoreReauth
BrowserMatch "(\s|^)neon/\d+.\d+.\d+(\s|$)" AuthnVisualSVNDisableNegotiate

Alias /web-ui-static htdocs/web-ui-static

<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

ErrorLog nul

LogLevel error

TraceEnable off

DefaultType text/plain

<IfModule mime_module>
    TypesConfig conf/mime.types
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType application/x-x509-ca-cert .crt
    AddType application/x-pkcs7-crl    .crl
</IfModule>

<IfModule ssl_module>
SSLEngine on

SSLRandomSeed startup   builtin
SSLRandomSeed connect   builtin
SSLPassPhraseDialog     builtin
SSLSessionCache         "shm:D:/Repositories/ssl_scache"
SSLSessionCacheTimeout  300
SSLMutex                default
SSLCertificateFile      certs/server.pem
SSLCertificateKeyFile   certs/server.pem
SSLProtocol             -ALL +SSLv3 +TLSv1
SSLCipherSuite          ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM

SetEnvIf User-Agent ".*MSIE.*" ssl-unclean-shutdown

</IfModule>

Include conf/httpd-custom.conf

Solution

Beginning with VisualSVN Server 3.5 it is possible to customize the repository URL prefix. In other words, now you can change the repo URL from http://server/svn/repo/ to http://server/repo/ in a few clicks.

In order to customize the URL prefix, follow these steps:

  1. Start VisualSVN Server Manager.
  2. Go to Action | Properties.
  3. Select Network tab.
  4. Select Customize under Repositories URL:

You can select "Empty URL prefix" option to remove the "/svn" prefix completely or select "Custom URL prefix" and specify the prefix you'd like to use in the URL (for example, "repos").



Answered By - bahrep
Answer Checked By - Timothy Miller (WPSolving Admin)