3

I'm running multiple Node.js Server on different ports and using Websocket in my client to connect with these different servers. Clients are making Ajax calls without websocket also using given server ports and everything is working fine.

Now the problem is that because I'm using nonstandard ports to run multiple node.js server so while making calls from client side, they are being blocked by firewall. So I want to introduce an Apache proxy in between and send all the retests to apache on standard port 80 and then interact with multiple Node.js servers in the background. I tried to explain existing and desired senario in attached file.

Need your help to have appropriate Apache proxy configuration to make it work. enter image description here

1 Answer 1

1

You can probably try with virtual host and proxy pass e.g.

    <VirtualHost *:80>
        ProxyRequests off
        <Proxy *>
                Order deny,allow
                #Require all granted
                Allow from all
        </Proxy>

        ProxyPass /A?query http://example.com/app
        ProxyPassReverse /A?query http://example.com/app

        ProxyPass /B?query http://localhost:8081/$1
        ProxyPassReverse/B?query http://localhost:8081/$1

        ProxyPassMatch "^(/.{1,})$" http://localhost:8082/$1
        ProxyPassReverse "^(/.{1,})$" http://localhost:8082/$1

  </VirtualHost>
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks Mahesh. I resolved my problem using Node.js based proxy instead of going with Apache. Actually here given ports are also dynamic. This solution is working with the following setup: tutorialspoint.com/codingground.htm
Hi! Can you please provide a link to that individual tutorial, as I would like to try the same thing?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.