Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configure Apache with multiple ProxyPass

Tags:

i am trying to configure my apache server as proxy to serve two internal services , one listening on 8080 and should receive traffic on specific URL and the other listening on 8077 and should receive all other http traffic

I deployed and configured apache on the same server where these two services running and it is listening to 443 along with all SSL configuration and it is working fine

also I enabled the proxy_module, proxy_http_module and proxy_http2_module

What I want to achieve

if the requested URL is /webhook1 --> pass it to EP1 http://localhost:8080 and any other requested URL should be passed to EP2 http://localhost:8077

My Current Configuration towards the first service

ProxyPass /webhook1  http://localhost:8080 ProxyPassReverse /webhook1 http://localhost:8080 

Now I want to define another proxy pass to be something like

ProxyPass /  http://localhost:8077 ProxyPassReverse / http://localhost:8077 

putting both configuration together is not working , appreciate your help in how to configure apache to achieve my requirement

Thank you in advance

like image 990
Qais Ammari Avatar asked Aug 28 '17 07:08

Qais Ammari


1 Answers

Put the ProxyPass rules in the correct order as required

if you want to evaluate /webhook1 rule and send it to 8080, else send the traffic to 8077 the rules should be on the following order

ProxyPass /webhook1  http://localhost:8080 ProxyPassReverse /webhook1 http://localhost:8080 ProxyPass /  http://localhost:8077 ProxyPassReverse / http://localhost:8077 
like image 138
Qais Ammari Avatar answered Sep 19 '22 13:09

Qais Ammari