By user1270392


2012-04-11 06:16:28 8 Comments

I want apache to forward request coming to one server to another server. Here is the complete scnario:

There are 3 servers:

  1. Machine A - IP: A.A.A.A - Client machine which wants to call an API there on machine C.
  2. Machine B - IP: B.B.B.B - Intermediate machine
  3. Machine C - IP: C.C.C.C - Machine hosting the API.

API URL: http:// Machine c:8000/v1/customer/....

Connectivity status:

  1. Machine A -> Machine B: Telnet on port 80 - Good
  2. Machine B -> Machine C: Telnet on port 8000 - Good
  3. Machine A -> Machine C: Telnet on port 8000 - Bad

Ideally, from Machine A I want to call an API on machine C, but since I do not have direct n/w connectivity between A and C, I have to take this route.

So I wanted to set up apache server on machine B such that: From Machine A, make an API call - http:// Machine B:80/v1/customer/.... which then forwards it to Machine C on port 8000. C serves the request and sends the response back to A.

The task might be simple but me being new to this apache, if someone can please tell me the solution, it will be great for my tomorrow's deadline :)

Thanks!

1 comments

@user1270392 2012-04-12 20:21:10

After some research and googling further was able to do it. Here is what I did - might be helpful to those who are facing the same problem:

In httpd.conf file of machine B added the following:

ProxyPass /v1/customer C.C.C.C:8000/v1/customer

ProxyPassReverse /v1/customer C.C.C.C:8000/v1/customer

Thus from the client (machine A) if the call is made as B.B.B.B/v1/customer, then it will be forwarded to C.C.C.C:8000/v1/customer

mod_proxy module is required for ProxyPass.

@william.berg 2013-01-13 20:37:29

Tick your own answer! I'm having the exact same problem with CherryPy.

@Sudarshan Shubakar 2015-05-25 07:59:36

This link provides more detailed info on this digitalocean.com/community/tutorials/….

@Vinaykumar Patel 2018-10-23 09:31:53

Above solution worked for me after uncommenting above this line in httpd.conf "LoadModule proxy_http_module modules/mod_proxy_http.so"

Related Questions

Sponsored Content

8 Answered Questions

[SOLVED] Difference between the Apache HTTP Server and Apache Tomcat?

5 Answered Questions

[SOLVED] How to redirect different sub domain requests to different port

  • 2009-02-26 06:29:30
  • Graviton
  • 23478 View
  • 17 Score
  • 5 Answer
  • Tags:   apache

19 Answered Questions

[SOLVED] Wildcards in a Windows hosts file

7 Answered Questions

[SOLVED] Why am I getting an Apache Proxy 503 error?

  • 2009-03-25 19:20:57
  • damon
  • 79954 View
  • 47 Score
  • 7 Answer
  • Tags:   apache

1 Answered Questions

[SOLVED] Is there a way to passthru SMTP sendings to another server?

0 Answered Questions

Cannot access Apache web server via external IP address

  • 2013-12-27 17:42:10
  • Daz
  • 23073 View
  • 4 Score
  • 0 Answer
  • Tags:   apache ubuntu

1 Answered Questions

django/apache - 2 separate servers

  • 2016-01-11 15:28:02
  • whoisearth
  • 47 View
  • 0 Score
  • 1 Answer
  • Tags:   django apache

1 Answered Questions

Port forwarding not working on my computer

1 Answered Questions

[SOLVED] Jboss to Apache forwarding

2 Answered Questions

[SOLVED] which Apache server will it use?

  • 2010-09-22 04:56:28
  • Sathish kumar
  • 46 View
  • 0 Score
  • 2 Answer
  • Tags:   php apache

Sponsored Content