[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cobalt-users] Re: Rewrite rule for admnserv/httpd on Raq4 for virtual site admin



I originally wrote:
I just upgraded from a Raq2 to a Raq4.  I was using Rickard Osser's
adminserv drop-in package on my Raq2 to do secure admin.  He whipped
me up some rewrite rules so that when I did:

    http://virtual.site.com/siteadmin/  instead of getting
    https://virtual.site.com:444/.cobalt/siteManage   \
     /virtual.site.com/index.html

I got
    https://my.raq.com:444/.cobalt/siteManage \
    /virtual.site.com/index.html

which meant that for admin purposes, all the virtual sites on the
machine could share my root-level certificate.

I thought that this would be the way it worked on the Raq4 since the
manual sort of implied it but I'm still getting the same behaviour as
the first example after I manually moved my certificate from the old Raq2
to the new Raq4 (the name of the machine stayed the same).

Does anyone know how to make admserv/httpd on the Raq4 elicit the
kind of behaviour I want?  I note that the /etc/httpd/conf/httpd.conf
has a whole whack of prototype rewrites and the
/etc/admserv/conf/httpd.conf doesn't seem to have any.

Since then, I've discovered that:

In /etc/httpd/conf/httpd.conf, there's a big block (as I mentioned earlier) of proto rules for rewriting. They look like this:

	$rewrite_rules =
	'RewriteEngine On
	RewriteCond %{HTTP_HOST}                ^([^:]+)
	RewriteCond %{DOCUMENT_ROOT}            !-d
RewriteRule .* proto://servername:81/.cobalt/error/forbidden.html [L,R]
	RewriteCond %{HTTP_HOST}                ^([^:]+)
RewriteRule ^/admin/?$ proto://servername:81/.cobalt/sysManage/index.html [L,R]
	RewriteCond %{HTTP_HOST}                ^([^:]+)
RewriteRule ^/siteadmin/?$ proto://servername:81/.cobalt/siteManage/%1/index.html [L,R]
	RewriteCond %{HTTP_HOST}                ^([^:]+)
RewriteRule ^/personal/?$ proto://servername:81/.cobalt/personal/index.html [L,R]
	RewriteCond %{HTTP_HOST}                ^([^:]+)
RewriteRule ^/.cobalt/(.+) proto://servername:81/.cobalt/$1 [L,R]
	RewriteCond %{HTTP_HOST}                ^([^:]+)
RewriteRule ^/cgi-bin/.cobalt/(.+) proto://servername:81/cgi-bin/.cobalt/$1 [L,R]
	';

	$rewrite_rules =~ s/servername/%1/g;
	$rewrite_rules =~ s/proto/$proto/g;


The $rewrite_rules =~ s/servername/%1/g is the one that's causing me my trouble. It rewrites everything to be whatever domain name was used to initiate the request, which is where you run into trouble with the site certificate not matching the domain name. If I change that line to:
$rewrite_rules =~ s/servername/raq.transcena.com/g;
Which is the name of my server, then it exhibits the behaviour I wanted. However, that's not a very elegant way of doing it. Anybody know how to get %{HOSTNAME} or some other environment variable that contains this name in there so that if you change the name of the Raq, it will still work later?

Thanks,

M

--

----|      TRANSCENA DESIGN  |----------------------------
Michelle A. Hoyle, VP Web Technologies, Canada
#801 T.D. Tower, Edmonton, Alberta, Canada  T5J 2Z1
N. America:  1-888-429-2363  |  UK:  020 7529 1465
International:  +1 780 429 2363
------------------|  internet design architects     |--------