Welcome to Geeklog, Anonymous Wednesday, January 01 2025 @ 11:28 am EST

Geeklog Forums

Geeklog with Apache proxy server - is there a problem?


Status: offline

tingo

Forum User
Chatty
Registered: 06/05/02
Posts: 57
Location:Oslo, Norway
I have been using Geeklog for a long time. I have a typical "home user" setup, that is, I only have one public IP address.
So I use dynamic dns services to get several domain names, and use Apache virtual hosts to have several geeklog sites (mostly for testing).

Note: all names have been changed to protect the innocent!

My setup currently looks like this:
host A: runs Apache 1.3.31, hosts Geeklog site "H" (in a vhost) and is the "reverse proxy" server for the other sites (also in vhosts).
host B: runs Apache 1.3.27 and hosts Geeklog site "M" in a vhost
host C: runs Apache 1.3.34 and hosts Geeklog site "test" in a vhost.

Some of these sites run an older version of Geeklog.
So far, everything is good. But now I'm going to upgrade (as in "total reinstall") host B. Therefore I'm installing a new Geeklog site on host C (I will move the old site from host B here), using the latest version of Geeklog. I call this site "new-test".
Here is the virtual host configuration on the main (and reverse proxy) server:
Text Formatted Code

## this is the httpd.conf file on hostA

<VirtualHost *>
    DocumentRoot "/usr/local/www/data/geeklog/public_html"
    ServerName H.dyndns.org
</VirtualHost>

<VirtualHost *>
    ServerName M.dyndns.org
    RewriteEngine on
    RewriteRule (.*)    http://hostB/$1  [P]
</VirtualHost>

<VirtualHost *>
    ServerName test.dyndns.org
    RewriteEngine on
    RewriteRule (.*)    http://hostC/$1    [P]
</VirtualHost>

<VirtualHost *>
    ServerName new-test.dyndns.org
    RewriteEngine on
    RewriteRule ^/(.*)  http://hostC/$1    [P]
    ProxyPassReverse ^/(.*)     http://hostC/$1
</VirtualHost>

 


On hostC I have the following virtual host configuration:
Text Formatted Code

<VirtualHost *:80>
    DocumentRoot /usr/local/www/web/test/public_html
    ServerName test.dyndns.org
</VirtualHost>
 
<VirtualHost *:80>
    DocumentRoot /usr/local/www/web/new-test/public_html
    ServerName new-test.dyndns.org
</VirtualHost>

 

The problem is that now matter what I do, it seems that Apache on hostC always uses the first (default) vhost section. I can easily test this, if I add the following section before the two others, I always get it instead of what I want:
Text Formatted Code

<VirtualHost *:80>
    DocumentRoot /usr/local/www/data
</VirtualHost>

 

(this is just the default data-dist directory of an Apache installation, ie the default frontpage).
According the the Apache documentation, the proxy module supports HTTP 1.1, meaning that host names are transported in the request, so this should work. But it doesn't.
There is probably a simple solution to this, and I am probably too tired to see it right now, so I need to put it down here for a while. Maybe somebody have a good suggestion on how to fix the problem.
 Quote

Status: offline

tingo

Forum User
Chatty
Registered: 06/05/02
Posts: 57
Location:Oslo, Norway
Ok, a good nights sleep helps some. :-)
Changing httpd.conf on hostC so that new-testsite.dyndns.org is the first (and default) vhost, and using http://new-testsite.dyndns.org/admin/install/info.php, I can see that the http headers aren't exactly like I thought they should be:
Text Formatted Code

Host = hostC
X-Forwarded-Host = new-test.dyndns.org

 

Ouch.
At this point, I'm unsure what I want.
Do I want Apache and / or Geeklog on hostC to use the X-Forwarded-Host header?
If so, how do I accomplish it?
Or do I want Apache on hostA to change the Host header?
Is it at all possible to change the Host header, or would that break things?

Any advice is welcome.
 Quote

Status: offline

tingo

Forum User
Chatty
Registered: 06/05/02
Posts: 57
Location:Oslo, Norway
Come on, there must be some of you who are using this configuration?
If not, how are you dealing with the "one ip address, one firewall, many (virtual) webservers behind it" problem?
 Quote

Status: offline

tingo

Forum User
Chatty
Registered: 06/05/02
Posts: 57
Location:Oslo, Norway
I finally tracked down a solution to this problem. First of all, this is an Apache problem, it is not directly related to Geeklog at all.
It turns out that I want the ProxyPreserveHost directive, which is normally only available in Apache 2.0 and above. However, for reasons of my own, I dio not want to upgrade at this time.
Luckily, there exists a patch for Apache 1.3 which (among other things) iimplements ProxyPreserveHost.
You can find the patch attached to this message.
It applied cleanly to Apache 1.3.34 (installed from ports on FreeBSD), and after a 'make extract;make patch;(do the patching in the correct directory);make install' I had an Apache 1.3 with ProxyPreserveHost included.
The proxy configuration section(s) on HostA now looks like this:
Text Formatted Code

<VirtualHost *>
    ServerName M.dyndns.org
    RewriteEngine on
    ProxyPreserveHost  On
    RewriteRule (.*)    http://hostB/$1  [P]
    ProxyPassReverse /  http://HostB/
</VirtualHost>

 

Case closed.
 Quote

All times are EST. The time is now 11:28 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content