1
votes

I'm quite new to HTTPS and I'm trying to host an Jetty HTTPS server from inside an OSGi bundle. Everything works great when I pass the below properties as VM arguments in my run configuration but since that is not an option for me, I'm supplying parameters inside the start method of the Activator using System.setProperties() method.

System.setProperty("org.eclipse.equinox.http.jetty.https.port", "9090");        
System.setProperty("org.eclipse.equinox.http.jetty.https.enabled", "true");
System.setProperty("org.eclipse.equinox.http.jetty.https.host", "0.0.0.0");
System.setProperty("org.eclipse.equinox.http.jetty.ssl.keystore", "/home/https/keystore.jks");
System.setProperty("org.eclipse.equinox.http.jetty.ssl.password", "password");

Using this approach, the HTTPS server on port 9090 works fine but there are two issues,

  1. The same webpage is also served on port 80 as HTTP which I don't want. It's there even when I use:

    System.setProperty("org.eclipse.equinox.http.jetty.http.enabled","false");
    
  2. Since the unwanted HTTP webpage gets hosted on port 80 (System port), I have to invoke the bundle as root otherwise I get Java.net.SocketException: Permission Denied

Since there might be other pages hosted on port 80, I don't want to disable HTTP altogether or manually unregister servers from port 80 in my bundle.

I'd really appreciate any pointers on how to stop this behavior without having to modify any other ports manually.

1

1 Answers

0
votes

I figured out that the server on port 80 was due to conflicts with another server hosted by another bundle on the device. Everything works as expected with the other bundle disabled. I'm still trying to get both of them to co-exist but the answers here and here are quite helpful.