I want apache to forward request coming to one server to another server. Here is the complete scnario:
There are 3 servers:
API URL: http:// Machine c:8000/v1/customer/....
Connectivity status:
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!
Redirect myapp.example.com to www.myapp.example.com Add the following in the installdir/apache2/apps/APPNAME/conf/httpd-vhosts. conf file in the VirtualHost block for your domain. Or, to apply this redirection by default for all domains, add it to the default VirtualHost block in the installdir/apache2/conf/bitnami.
In Apache, you can implement single-page redirects using the “Redirect” directive, which is included in the mod_alias module that is enabled by default. This directive takes at least two arguments: the old URL and the new URL.
Apache can be configured as both a forward and a reverse proxy. An ordinary proxy (also called a forward proxy) is an intermediate server that sits between the client and the origin server. The client is configured to use the forward proxy to access other sites.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With