Advertisement

05.16.2008 at 10:01AM PDT, ID: 23409018
[x]
Attachment Details

Use mod_rewrite to redirect traffic to web server on the internal net

Asked by dataline in Apache Web Server, FreeBSD, Ruby Scripting Language

Tags: , , ,

I have a FreeBSD machine acting as NAT/web/mail server and a couple of machines on the internal network. One of them is Mac OS X 10.5 Server running Apache 2.2 with load balancer and reverse proxy which I would like to use to deploy ruby on rails aplication.

The OSX machine has internal IP address 192.168.168.237, mongrel is started with 4 instances on ports 3000-3003 and apache load balancer pointed to 4 instances. It works great on the local network.

I would like to use mod_rewrite on the NAT server to redirect communication to the OSX server so:

jobs.example.com points to the web server running on 192.168.168.237 and is accessible from the internet. Enclosed is my apache virtual server settings.

When I use the jobs.example.com address in the browser, it shows the rails application, but when I attempt to login, it _switches_ to internal network:

http://jobs.example.com/login ------> http://192.168.168.237/projects/show/

Does anybody have an idea how to get it to work?Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
<VirtualHost *>
 ServerName jobs.example.com
       <IfModule mod_rewrite.c>
                RewriteEngine On
                RewriteCond %{HTTP_HOST} jobs.example.com
                RewriteRule ^/(.*) http://192.168.168.237/$1 [QSA,P,L]
        </IfModule>
 
</VirtualHost>
[+][-]05.16.2008 at 11:01AM PDT, ID: 21585012

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Apache Web Server, FreeBSD, Ruby Scripting Language
Tags: Unix, apache, mod_rewrite, 1.3, 2.2, ruby on rails
Sign Up Now!
Solution Provided By: logicmatt
Participating Experts: 1
Solution Grade: B
 
 
[+][-]05.16.2008 at 11:47AM PDT, ID: 21585369

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628