Running two services on port 80

Solution 1:

Absolutely, you can bind two services to the same port on different IPs.

Just set up Apache and Maven to bind to a specific IP address.

Solution 2:

Yes you can. Just bind Apache to one IP, and Maven to another IP

I am going to assume that it is the cross-domain policies of Javascript you are trying to overcome. It is relatively easy to do communication cross subdomain in Javascript, however not by default.

All you would need to do is set up, for example:

  • www.example.com - Apache's IP
  • app.example.com - Maven's IP

If you try to do a call to app.example.com from www.example.com, the clients javascript security will prevent it from doing so. However, you can reduce the restriction from only the subdomain, to the domain itself with the following javascript:

document.domain = "example.com";