Page redirection to an internal server.

Posted on 2004-08-22
Last Modified: 2010-03-04
I have a webmail system that I would like access from the internet. The problem is I have 2 server the First is a web server running apache. The 2nd server is the mail server that also has apache on it and runs the webmail. I have it all behind a router and on the router port 80 is forwarded to the web server. So now I have a problem I dont know how to make the webmail page on the mail server accessible to the internet.

Jesse Sparks
Question by:Jesse_Sparks
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 2
  • +1
LVL 34

Expert Comment

ID: 11866423
OK, so Port 80 traffic from the Internet is forwarded to Web Server 1. And Web Server 2 host the Webmail system. Right?

If that's the case, you can't do what you want. Page redirection just tells the browser "The place you're looking for is over there." The browser then opens a connection to "over there" and gets what it wants.

If your network arrangement does not forward Port 80 traffic to Web Server 2, then a browser out on the Internet is not going to be able to get to "over there", no matter how much Web Server 1 tells it that it needs to go "over there".

The solution would be to register a name in DNS for Web Server 2 and configure your network arrangement to forward Port 80 traffic to it. Be sure your redirection uses the proper URL. The when Web Server 1 told a browser to go "over there", the browser could actually get there.
LVL 48

Expert Comment

ID: 11868494
You might use the mod_proxy of apache to access the second server from the first server.
So you connect to the first server to and apache passes only for that directory the request to http://yoursecondserver/webmaildir/
LVL 15

Expert Comment

ID: 11869502
addition to hernst42,

You could even register another DNS name for webserver1. let say this name is, and create a virtualhost on webserver1, and inside that vhost, do a referse proxt to server2.  In this way, you external client would only use 

it works pretty much like the initial suggestion as hernst42 mentioned, but will be a bit better.  Based on my experience, some apps tend to have static linking in their HTML codes, so if on webserver2, you had http://webserver2/something.html, then your may have some problem, since the proxied page may not get rewritten properly.

Give some thought on the available suggestion -- and decide .. we will elaborate on that.

I kinda like PsiCop suggestion - clean, and straightforward.  But *lack* of challenge :)

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.


Author Comment

ID: 11871858
I have a DNS entry for and right now I have a redirect html page on my webserver that points to and I have setup the mail servers apache to listen on port 76. This solutions is working but I think there is a better way. Im not sure what you mean to register a name in DNS for the mail server. My router has all traffic on port 80 going to the internal IP of the webserver, not sure how to tell it of the header is webmail to look at the email server.

LVL 15

Expert Comment

ID: 11884703
is the Linksys box?  or some  exterrnal host?  I am confused :(

depending on how the redirection is configured.  Apache on the backend, would receive the request (if redirection works properly) and examine the Host header of the request, and will pass it to the defined Vhost (or the defaulf vhost is ne matches).
LVL 34

Expert Comment

ID: 11884724
"I kinda like PsiCop suggestion - clean, and straightforward.  But *lack* of challenge :)"

I'm partial to things that work reliably with a minimum of fuss. Probably why I don't like Windoze. :-)

Author Comment

ID: 11886727
Okay so what I have is 2 Linux server both run apache, one server is a webserver setup with Vhosts for 20 sites or so and the other server is my mail server but it has my webmail running on it as well. I have a snapgear router connected to the internet and both my servers behind that rounter. I have port 25 forwared to the Email servers internal IP and I have port 80 forwarded to the internal IP of the webserver. The problem is how do I get an internal client from the web to be able to see the webmail site when all of the port 80 traffic is going to the webserver. Does that make it better?
LVL 15

Expert Comment

ID: 11891640
hi Jesse,

lets, name Linux1 - host the 20 vhosts, and Linux2 host the mail, and also had webmail installed/configured on port 80.
the router had redirector - port 80 to goto linux1, and port 25 to linux2.

create another dns name for, and also add another vhost to linux1 (now we had 21 total vhosts on linux1).  On this Vhost, just defined a ProxyPass/ProxyPassReverse to linux2.

With this approach, external clients would be using, they will hit your router, which will redirect the traffic to linux1.  The Vhost for, will do proxy this request to http://linux2:80/.

This should work.

If your opt to the "clean, and straight forward" way as PsiCop suggested, you ned to ensure that your router could redirect based on the TargetAddress (which I really could not confirm), and redirect traffic to Linux2.  With this method, the DNS name would still have the IP address of the router.  Still clean, but I am not sure where it would be possible with you router.

I would (personally like) the Vhost on Linux1 to reverse proxy content on Linux2 for some reasons -- challenge is one, proxy/caching capability (not that make much difference), can customize error message in the even that linux2 is not reachable. etc. etc.  But again, we had 3 dependencies - rouer, linux1, and linux2, as compared to redirector on router, only had 2 points of failure, router and linux2.

I hope I am not repeating any previous commnet :)

Author Comment

ID: 11892506
That is great and sounds like it should be better and cleaner then my hack install. How do I setup a ProxyPass/ProxyReverse to go to linux2? If someone could give my some ideas how this works or where I can read up on it that would be great.

LVL 15

Accepted Solution

samri earned 125 total points
ID: 11894640

You may jump to Apache mod_proxy module docs at which should give you enought headache to start with.  If you hate that, jump straight to

Or still if you are so lazy :)
The following would be in the Vhost container of (on Linux1 machine).

<VirtualHost ...>
#  ...   ... the other stuff ...
  Reverse Proxy
  ProxyRequests Off

  <Proxy *>
    Order deny,allow
    Allow from all
  ProxyPass             / http://IP_address_of_linux2_machine/
  ProxyPassReverse / http://IP_address_of_linux2_machine/

However! Apache on Linux2, would be seeing request coming from Linux1 machine - kind of. To monitor usage/connection, you would need to pay attention to logfile on Linux1.

Hope this helps.


Author Comment

ID: 11894666
Thanks for all your help that is great.

Featured Post

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Increase size of permitted URI 4 66
Best IDE for PHP starters 11 151
Do you know any Office editor web for IIS or Apache web server)??? 10 110
PHP_POST() error message 9 104
In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting ( to http…
Introduction This article is intended for those who are new to PHP error handling (  It addresses one of the most common problems that plague beginning PHP develop…
In a recent question ( here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question