0

I have two web applications http://app1:8080 and http://app2:3000 running on two different ports and different machines. I have to pass the applications traffic through Apache web server, http://myapp.

Now, we can configure apache webserver as reverse proxy based by mounting application to specific location. For example,

ProxyPass /app1/ http://app1:8080/
ProxyPass /app2/ http://app2:3000/

ProxyPassReverse /app1/ http://app1:8080/
ProxyPassReverse /app2/ http://app2:3000/

After this mapping, http://myapp/app1 points to http://app1:8080 and http://myapp/app2 points to http://app2:3000.

But, my requirement is http://myapp:8080 should point to http://app1:8080 and http://myapp:3000 should point to http://app2:3000. Kindly guide me how to reverse proxy the traffic on the basis of ports in apache web server.

  • 1
    Did you tried to create virtual host with specified port ? – Froggiz Jan 7 '16 at 9:56
1

You would need to create two separate Virtual Hosts, with the different ports you want.

You would need

<VirtualHost *:8080>
    ...
</VirtualHost>

<VirtualHost *:3000>
    ...
</VirtualHost>

You also will need to set Apache Listen directives for both those ports

Listen 8080, 3000

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.