Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Apache has dual personality: sends 200 to the browser and 301 to curl.

Status
Not open for further replies.

outre

Programmer
Jul 27, 2008
2
TH
All,
i'm at the end of my rope here. It's been 3 days and i can't figure it out.

Here's the problem. I'm running Subversion repository and am making it available through a https virtual host. When i access the address through the browser it presents the certificate (homemade for now), requests user login, and displays the contents for the repository. Everything is fine.
But when i try to access the same repository over TortoiseSVN or test with curl i get 301 Permanently Moved response (see below for message details.)
There are no mod-rewrite rules or redirect directives in htppd.conf file or any imported .conf files. I also don't see 301 reponse in the VH log at the debug level.

So where is this 301 coming from? I need help, please.

**************************
curl command and response from my home linux box to the server:

[kiril@KDevBox ~]$ curl -k -u xxxxx:yyyyyy <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="<hr>
<address>Apache/2.2.3 (CentOS) Server at repo.beartechsolutions.com Port 443</address>
</body></html>
[kiril@KDevBox ~]$

*************************
last lines from the error log. everything else has to do with ssl processing. log level is set to debug. there's no mention of 301 status anywhere.

[Sun Jul 27 20:56:56 2008] [debug] ssl_engine_kernel.c(1765): OpenSSL: Read: SSL negotiation finished successfully
[Sun Jul 27 20:56:56 2008] [debug] ssl_engine_kernel.c(1770): OpenSSL: Write: SSL negotiation finished successfully
[Sun Jul 27 20:56:56 2008] [info] [client 124.120.224.228] Connection closed to child 0 with standard shutdown (server repo.beartechsolutions.com:443)



**************************
The applicable extract from the httpd.conf file:

NameVirtualHost 203.151.233.136:80
NameVirtualHost 203.151.233.136:443

...

<VirtualHost repo.beartechsolutions.com:443>
ServerName repo.beartechsolutions.com

# Turn on SSL access
SSLEngine on
SSLCertificateFile /etc/httpd/conf/ssl.crt/cert.pem
SSLCertificateKeyFile /etc/httpd/conf/ssl.key/key.pem

# Directory / is needed here to enforce SSL for the entire vhost,
# including global aliases. This prevents accidental access to
# global aliases without SSL.
<Directory />
Options FollowSymLinks
SSLRequireSSL On
</Directory>

DocumentRoot /reporoot
<Location />
DAV svn
SVNParentPath /reporoot
AuthType Basic
AuthName "SVN Repos"
AuthUserFile /etc/svn-auth-file
Require valid-user
SVNPathAuthz off
</Location>

<Files ~ "\.(cgi|shtml|php)$">
SSLOptions +StdEnvVars
</Files>

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

CustomLog /reporoot/logs/svn_logfile "%t %u %{SVN-ACTION}e" env=SVN-ACTION
ErrorLog /reporoot/logs/repo_error.log
LogLevel debug
</VirtualHost>
 
Namevirtaual does not work with https. I am guessing it is taking the default action, and that is why it gets a 301. (the default is always the first vhost entry.) I would is IPnamed virtual hosting, if possible.
 
Thanks elgrandeperro.
Your pointer proved very helpful. I did some research into the matter Here's a good article describing the problem:
Since SSL does not allow multiple SSL virtual hosts to coexist on the same ip:port i moved them on separate ports. That solved the curl problem. However, the second part of the problem still persists. The virtual host in question serves Subversion repository using SSL. Even though i can access the repository through the browser and now curl, when i try to do the same with an svn command or TortoiseSVN client i get the same "301 Permanently Moved" message.
Any other ideas?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top