logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: How to use reverse-proxy with mod_rewrite in Apache
Author
slehmann36



Joined: 05 Nov 2014
Posts: 1
Location: Australia, Perth

PostPosted: Wed 05 Nov '14 17:08    Post subject: How to use reverse-proxy with mod_rewrite in Apache Reply with quote

Hi,

I am running a few different web servers on my home network and have found a way of binding each wb server (and any virtual hosts) to domain names and having a "central" web server rerouting a request to the appropriate server using reverse-proy. at the moment, this central web server is IIS (Windows Server 2008 R2) based and it works perfectly. I want to change the central server to an Apache based one.

As an example; I want the central server to see an incoming http request (e.g sub.domain.com) and reroute it using reverse-proxy to a different web server that wouldn't normaly be accessible from the Internet (e.g 192.168.1.122/index.html).

My question is how do you reverse-proxy to a different server on the LAN with mod_rewrite in Apache?

Any help will be greatly appreciated.

Thanks

Edited by slehmann36, Today, 09:21 AM.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Thu 06 Nov '14 0:13    Post subject: Reply with quote

There is no need to use mod rewrite, but set up apache as a real reverse proxy.

an example for a vhost for a subdomain.

Code:

<VirtualHost *:80>
    ServerName sub.domain.com
    DocumentRoot "C:/Apache24/htdocs"
    <Directory "C:/Apache24/htdocs">
        Options Indexes Includes FollowSymLinks
        AllowOverride None
        Require All granted
    </Directory>
    <Location />
        ProxyPass http://192.168.1.122/
        ProxyPassReverse htto://192.168.1.122/
    </Location>

    SetEnv vhostname jenkins
    Header add X-Server-Name %{vhostname}e
</virtualhost>
Back to top


Reply to topic   Topic: How to use reverse-proxy with mod_rewrite in Apache View previous topic :: View next topic
Post new topic   Forum Index -> Apache