0

I have a Linux Server (Ser1) on which an application is running on Apache and tomcat using proxy. This server has a registered domain name abc.web.example. Because of traffic, company has taken another Linux Server (Ser2) (with no domain name).

What I want is, whenever there is a hit on abc.web.example it should access the same server. But when there is a hit on abc.web.example/panda the request should be redirect to another server (Ser2)

Re-paraphrasing:

Ser1  abc.web.example    IP: 10.201.x.x  
Ser2  No domain name     IP: 10.201.y.z 

Note: Ser2 should be accessed by url abc.web.example/panda

  • 1
    I don't meant to be rude, but it seems according to the blurry explanation you gave that you don't really understand nor master your topic. Be careful when you will try the answer (which seems OK) – Kiwy May 22 '18 at 12:15
  • If I had mastered it then why would I ask it here. Asking something will never means it will comprehend everyone's intellect. By the way thanks for your comment. – erTugRul May 22 '18 at 12:40
  • You will have less problems if you gave a name to the second one, like ser2.web.example even if it resolves only locally, so that configuration at ser1 will be simpler. You just need proxying at the HTTP level. – Patrick Mevzek May 23 '18 at 6:15
  • @PatrickMevzek I didn't give domain name not to make any confusion as for this server there is no domain name. Yes, I can give ser2.web.example that could be locally resolve. – erTugRul May 23 '18 at 7:47
  • I do not see how not giving the name helps in not confusing things. On the opposite I believe that without a name it makes things less clear. Also the proxying will be more complicated, as webservers needs hostnames and not just IP addresses because multiple websites could be installed on the same IP. – Patrick Mevzek May 23 '18 at 13:32
1

As an architectural solution, which is very dependent of the particular application you've got, I'd suggest you consider something like this:

  1. Set up DNS so that your canonical website name points to both servers (round robin, if you have the choice).
  2. Set up Tomcat on both servers, sharing the same data source.
  3. Set up Apache on both servers with a load balancing split between the local Tomcat and overflow to the other. If you can't do that, set it up to send /panda to one and everything else to the other.

This will allow you to mediate requests using both servers, even if only one of them is able to service the actual response.

0

You can configure apache to proxy the request to Ser2:

ProxyPass "/panda" "http://ser2.web.com"

Or if Ser2 has no domain name, you can proxy to the IP:

ProxyPass "/panda" "http://10.201.y.z"

  • I have already tried that. It is redirecting to the same server (Ser1). Also, I am already using ProxyPass to redirect it to tomcat. As: "ProxyPass / localhost:8080" – erTugRul May 22 '18 at 10:13
  • 2
    Ordering is important: ProxyPass / localhost:8080/ proxies everything that matches / (that is, all URIs) to tomcat, including /panda. First match wins. So you must place ProxyPass "/panda" ... before ProxyPass / .... – telcoM May 22 '18 at 10:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.