Apache mod_rewrite or mod_proxy usage

Have a need to give outside access via an apache server (2.4) to a couple of inside machines on a LAN. Machine has a valid hostname, and has another network connection into the LAN.

Internally the site works as it should.

There is a singe page in PHP with a CSS file and a few images that has links to a few servers.

A couple of these servers just display some bandwidth graphs from the links on the base PHP page.

One link redirects to a Nagiosxi VM that does auto-login and displays a
status page of some specific hosts.

I have been trying to use mod_proxy/mod_rewrite on the Apache machine and
have had limited success.

I think I am confused whether I should be hosting the base PHP page and related files on the Apache machine and redirecting from there or redirecting the whole thing to the internal machine that hosts the main PHP page/CSS file and a few basic image files.

And whether I should be using mod_proxy or mod_rewrite in this case.

The bandwidth graphs link I can get to come up, but all the images links are broken. I use rrdcgi to generate and display the graphs, and get an end of script headers in the log file. So CGI is not working correctly.

An addendum:

I have been using this through virtualhost container:

<VirtualHost *:80>
    ServerAdmin admin@mydomain.ca
    ServerName test.mydomain.ca
    DocumentRoot "/usr/local/www/apache24/data"

    RewriteEngine On
    ProxyRequests Off
    RewriteCond %{HTTP_HOST}   !^$

    <Location "nagiosxi">

    ProxyPass "/" ""
    #ProxyPassReverse "/" ""

    ErrorLog "/var/log/httpd-error.log"
    CustomLog "/var/log/httpd-access.log" common


As this sits, when I visit test.mydomain.ca, I get directed correctly
to the internal server that the index.php file is hosted on and the page loads.

I have a link on that page:

<a href="#" onclick="javascript:popupbig3('nagiosxi')"> New Link </a><br>

When i click that link, the client I am testing from always wants to connect
directly to

So I think the proxy is working but how do I prevent the web browser client
that I’m on NOT want to connect directly to the internal machine?

is there a proper way to make a link in this case? I’m more than a little
stumped here.



Leave a Reply