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 http://1.1.1.1/nagiosxi
    </Location>

    ProxyPass "/" "http://10.2.1.1/sd/"
    #ProxyPassReverse "/" "http://10.2.1.1/sd/"

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

</VirtualHost>

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 1.1.1.1.

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.

Thanks.

Related:


Leave a Reply