0

I have a Linux virtual server hosted on DigitalOcean, on which I run Glassfish with some web services located at my_ip:5757/services/. The admin console is at my_ip:4848/. I also run a database client (H2), accessed remotely at my_ip:8585. I would like to access all of these services remotely without ever typing a port number, for example in the form my_ip/services, my_ip/console and my_ip/database. Is there a simple way to do this? As for the web services, I guess I could set a rule in iptables to redirect the port 5757 to 8080, however for the other services it’s not clear to me. I thought about adding a new webservice in Glassfish (using JAXB) called database/ and somehow map it to localhost:8585, but I don’t know how. Is there a simple way to do this?

1 Answer 1

0

Install apache on this host and create reverse proxy for different services

ProxyPass /db http://localhost:8585
ProxyPassReverse /db http://localhost:8585

and so on. Check here for more information

3
  • Thanks, I will check that solution, but I was wondering if I could achieve the same thing in Glassfish without installing another server just for that. Feb 5, 2015 at 10:43
  • Glassfish is Java application server and I do not think mini http server inside have such functionality. But if you are good in programming you can create own reverse proxy in java. Nevertheless from my point of view this is bug effort compared to just install and configure apache server Feb 5, 2015 at 10:54
  • 1
    If you wanted to do this with just GlassFish, you would need to change port 8080 to just 80 and port 4848 to 443. These are the default port numbers that your browser will try to open a connection on, so GlassFish needs to listen on those for this to work. This is a bad idea though! It means GF will take all your web traffic to that host, and GF isn't really built to manage that as well as Apache. So it is possible, but the accepted answer is the best way.
    – Mike
    Feb 25, 2015 at 14:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .