Question

How to use Apache proxy on Openfire

Asked by: SW111

We have a number of server behind a firewall on the dmz zone.
Some of these servers are offering http service (either for management or one that users actually need to login).

The problem is that we have only 1 IP address. (say 1.1.1.1)
The good news is that most of these servers (not all) can easily change the port that we need to use to something other than 80 (say port 1234 for server A, 2345 for server B, 3456 for server C, and so on)

We have no problem accessing the sites from the internet (remote location) by entering: 1.1.1.1:1234, 1.1.1.1:2345 and so on.

we want to be able to access each service using our domain name:
http://mydomain.com/serverA/
http://mydomain.com/serverB/
http://mydomain.com/serverC/
and so on.

So I've setup a mod_proxy addon on  a machine, which is using Apache. I setup the firewall to route port 80 to this machine and I added something like this to httpd.conf:

ProxyPass /serverA http://50.0.0.5:12345/serverA
ProxyPassReverse /serverA http://50.0.0.5:1234/serverA

ProxyPass /serverB http://50.0.0.5:12345/serverB
ProxyPassReverse /serverB http://50.0.0.5:1234/serverB

which seems to work only for the front page. As soon as the user entered their credential via a login screen then we'll immediately see either a messed up page or a not found page.

Can someone please help? We've been trying to solve this problem for almost a year....




This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-10-21 at 07:06:55ID24830635
Tags

apache mod proxy web service

Topics

Apache Web Server

,

Web Hosting

,

Web Services and WCF

Participating Experts
2
Points
500
Comments
9

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Apache Modules...httpd.conf
    I have installed apache 2.0.43 on a Solaris 8 machine...I used the following elements when running .configure --enable-modules=all --prefix=/opt/foo --with-mpm=prefork Apache runs with the basic httpd.conf, but when I try to apply the httpd.conf that the previous developer ...
  2. Apache -httpd.conf error
    My problem is that Apache won't start up. The error coming back is: Syntax error on line nnn of /etc/httpd/conf/httpd.conf: ScriptAlias takes two arguments, a fakename and a realname That line looks like: ScriptAlias /cgi-bin/ "/home/httpd/cgi-bin/"" Would s...
  3. Webmin and Apache
    I am currently running Apache and Webmin. The webmin docs say that I can make webmin accessible via an Apache virtual host (like webmin.mydomain.com) by using mod_proxy. However, I cannot seem to find mod_proxy. Not even at modules.apache.org It goes on to say that I shou...
  4. Help with apache reverse proxy configuration
    Hi All ..... Hope some apache guru out there can me out..... I have a situation -- where some external clients are not able to see some administrative web applications we're hosting off an intranet/non-DMZ server. I'm toying with the idea of either: 1) Giving the machine an...
  5. Apache Configuration httpd.conf
    Guys, I have a dedicated p4 2+ Ghz server with one instance of Apache 2.0.54+ running. RAM: 512 MB OS: Fedora 5.0 Yesterday I have installed Lace Chat from (http://socket7.net/lace/) Its a very simple ajax chat. The problem I had was that CPU utilization is reaching 60% and ...
  6. Tomcat server root application with apache http proxy on c…
    How to set up tomcat 5 + apache httpd proxy at the root so that http://mydomain.com will hit my application? I am running centos and both http and tomcat are running as default sevices.

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: arober11Posted on 2009-10-21 at 17:25:51ID: 25629788

Hi

Without  going through all the content/links on your servers, and removing all absolute (http://) links you probably won't make that solution work.

You may have more luck if you go for several name based vrtual hosts e.g.

http://serverA.mydomain.com/
http://serverB.mydomain.com/
http://serverC.mydomain.com/

This may require a DNS tweak, a few CNAME entries, but you'd probably hit fewer issues.

 

by: SW111Posted on 2009-10-21 at 20:59:43ID: 25630712

Hello Arober11,
Thank You for your reply.

I probably have to tell you also that my understanding is not that deep, especially on this Apache thing :)

So can you please tell me how to go about making this virtual hosts, and how this solution can work for my situation? I had thought that virtual hosting means we're hosting multiple websites on 1 apache server (similiar to virtual email on postfix)

Additional information:
1. I do not have a DNS server on this zone (DMZ zone). Did you mean I should prepare a DNS server on this zone too? I didnt think it would help since I'm not trying to connect to each host using its computer name but rather the service name. (Eg: ServerA is actually running on a computer called HostA. I really should have said ServiceA instead of ServerA)

 

by: arober11Posted on 2009-10-22 at 02:43:58ID: 25632263

Before I start on the Virtual host solution have you tried the following ProxyPass / ProxyPassReverse  convention:

ProxyPass /serverA http://50.0.0.5:12345/
ProxyPassReverse /serverA http://50.0.0.5:1234/

ProxyPass /serverB http://50.0.0.5:12345/
ProxyPassReverse /serverB http://50.0.0.5:1234/


Virtual hosts allow you to host multiple Hosts (sites) on a given Apache server, either directly or indirectly (proxying). The multiple hosts can share an IP (Name based virtual hosts), which would allow you to allocate a separate  [sub-]domain name to each of your internal servers, DNS permitting.

Start by pinging the hostnames:
ping -a www.mydomain.com
ping -a serverA.mydomain.com
ping -a serverB.mydomain.com
ping -a serverC.mydomain.com

If they all return the same IP your good to proceed with a virtualhost setup, else youll need to request a few CNAME entries to be added to resolve all the hosts to the same IP. Then add something along the following lines to your httpd.conf and restart apache:


NameVirtualHost 12.34.56.78   #the common IP

<VirtualHost 12.34.56.78>
   ServerName www.mydomain.com
....
 # Defualt no proxied site
</VirtualHost>

<VirtualHost 12.34.56.78>
   ServerName serverA.mydomain.com
....
  ProxyPass / http://50.0.0.5:1234/
  ProxyPassReverse / http://50.0.0.5:1234/
</VirtualHost>


<VirtualHost 12.34.56.78>
   ServerName serverB.mydomain.com
....
  ProxyPass / http://50.0.0.5:2345/
  ProxyPassReverse / http://50.0.0.5:2345/
</VirtualHost>

...

 

by: SW111Posted on 2009-10-22 at 06:37:02ID: 25633970

Well, on the proxy thing:
Yes, that is how it is currently setup. It will go only to the first page (normally a login screen of each service) and then as soon as we login then something would go wrong.

I've just thought about this today (but haven't had the chance to try it): is it possible that it should be:

ProxyPass /serverA http://1.1.1.1:12345/ <-----Use Public IP address
instead of
ProxyPass /serverA http://50.0.0.5:12345/ <------Use local IP address ?

On Virtual Host:
"Virtual hosts allow you to host multiple Hosts (sites) on a given Apache server".... Thats what I thought. Isnt this for multiple service (=virtual host?) on a single server machine? My situation is exactly the reverse: multiple machine on a single IP address.






 

by: SW111Posted on 2009-10-22 at 06:48:55ID: 25634113

nope. doesnt work. using:
"ProxyPass /serverA http://1.1.1.1:12345/ <-----Use Public IP address"
results in the same error....

 

by: arober11Posted on 2009-10-22 at 08:02:05ID: 25635033

Re: "My situation is exactly the reverse: multiple machine on a single IP address."  

That what Name based Virtual Hosts + mod_proxy are for :)


 

by: caterham_wwwPosted on 2009-10-22 at 09:56:46ID: 25636332

> It will go only to the first page (normally a login screen of each service) and then as soon as we login then something would go wrong.

And you should investigate why. Are error messages (you talked about 404 not found) generated on your frontend or backend server? Did you set LogLevel to debug? Did you analyze the access logs? I.e. what was requested at your frondend server, what was requested at your backend server by mod_proxy? Compare "what was requested at your backend server by mod_proxy" with the orgin request and the information logged by mod_proxy into the error_log with loglevel debug.

Use network tools (wireshark) to examine the complete HTTP traffic both at your client and Apache HTTP Server. What are the differences between a (working) direct request and the request made by mod_proxy towards your backend server? Was something lost between client request -> mod_proxy -> backend?

Monitor responses backend -> mod_proxy -> client as well. Are cookies lost? Are cookies containing the correct path and domain? You may want to look at the directives ProxyPassReverseCookieDomain and ProxyPassReverseCookiePath as well if your backend issues wrong cookies due to unawareness of your frontend server.

 

by: SW111Posted on 2009-10-22 at 20:48:51ID: 25641234

Arober: Ok. I'll look up into your solution on virtual host more then.

Caterham,
I'm assuming Frontend = the apache server where port 80 from the internet is directed to, and
Backend = the machines that host the services I'm trying to provide?

I'd be very interested to find out: "Compare "what was requested at your backend server by mod_proxy" with the orgin request and the information logged by mod_proxy into the error_log with loglevel debug.".
How do I go about doing this?

Sorry, I'm pretty much lost on your other instructions. I'll try to digest those slowly later on.....

The thing is that if I typed: http://1.1.1.1:1234 then it would work.
And since I have a vpn, if I typed http://50.0.0.5:1234 it would also work.
To my imagination, with mod proxy we're saying: http://mydomain.com/ServiceA/ = http://1.1.1.1:1234/ which works out fine for the front page. But as soon as we login, the software outputs url like these:

1. http://mydomain.com/control.php which would give a Not Found error
I don't understand why this would give an error because the above should be equal to: http://1.1.1.1:1234/control.php (which would work if I input this in browser)

2. http://mydomain.com/ServiceA/control.php
This would mess up the display of the second page, and any link from this page would give a Not Found error. I kinda see why it would not work because it is equal to http://1.1.1.1:1234/ServiceA/control.php which shouldn't exist (and yet it went 1 step further than no. 1 above)


20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...