Re: Redirecting to internal server

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

 



On Nov 23, 2007 6:52 PM, Paul Cocker <paul.cocker@xxxxxxxxxxxxx> wrote:
Hi all, first time on the apache list so have mercy ;)

I have been tasked with setting up a system whereby a Linux server
running apache 2.0.59 in the DMZ takes requests on port 80 and then
passes them through to an internal Windows server running IIS which
actually hosts the HTML.

Such a setup already exists (though it's Linux to Linux) so I thought
this would be relatively easy to do, just copy the existing setup.
People currently connect to http://www.domain.co.uk/folder/login.html
and all is well. Searching the httpd.conf file I can find only one
reference to folder, which is:

<VirtualHost *:80>
    ServerAdmin administrator@xxxxxxxxxxxx
    ServerName www.domain.co.uk
    DocumentRoot /var/www/html/domain
    RewriteEngine on
    RewriteRule ^/folder(.+)     https://www.domain.co.uk/folder$1 [R,L]
    RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
    RewriteRule .* - [F]
</VirtualHost>

So we're using the rewrite module... except having read the
documentation on this feature I cannot fathom it.

I hoped that with the above I could simply add another line:

RewriteRule ^/folder2(.+)    https://www.domain.co.uk/folder2$1 [R,L]

I then added a route for the relevant server so the traffic is routed to
the internal network when its name is called. However, without really
understanding the above I'm not in much of a position to progress
further when this invariably fails to work. I don't know whether the
above in any way relates to the name apache calls which then causes the
call to be routed to server X.

Any advice or guidance you can offer would be much appreciated.

Paul Cocker
IT Systems Administrator

Your example is not rewriting to an internal server.  You want to use mod_proxy.  Let's say your windows box is 192.168.1.100, then you want something like this inside your VirtualHost directive:

ProxyRequests off
ProxyPass /folder2 http://192.168.1.100
ProxyPassReverse /folder2 http://192.168.1.100

With this, anytime someone visits your externally accessible site at http://www.domain.co.uk/folder2, they'll see the html output by your windows server at http://192.168.1.100 and your internal IIS host is never directly accessible from the internet.

cheers,
Victor

--
http://www.victortrac.com
[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux