[New] Added Nginx HTTPS Override

HTTPS routing override can be activated by setting keystore path to
'nginx' - In this mode Plan uses HTTP server and gives out HTTPS links.

Affected issues: #669
This commit is contained in:
Rsl1122 2018-10-23 15:12:45 +03:00
parent 314e0a2ca7
commit 98aaff0328
1 changed files with 8 additions and 0 deletions

View File

@ -117,6 +117,9 @@ public class WebServer implements SubSystem {
if (!usingHttps) {
logger.log(L.INFO_COLOR, "§e" + locale.getString(PluginLang.WEB_SERVER_NOTIFY_HTTP_USER_AUTH));
server = HttpServer.create(new InetSocketAddress(config.getString(Settings.WEBSERVER_IP), port), 10);
} else if (server == null) {
logger.log(L.INFO_COLOR, "§eWebServer: Nginx HTTPS Override enabled. HTTP Server in use, make sure that your Nginx is routing with HTTPS and AlternativeIP.Link points to Nginx");
server = HttpServer.create(new InetSocketAddress(config.getString(Settings.WEBSERVER_IP), port), 10);
}
server.createContext("/", requestHandler);
@ -138,6 +141,11 @@ public class WebServer implements SubSystem {
private boolean startHttpsServer() {
String keyStorePath = config.getString(Settings.WEBSERVER_CERTIFICATE_PATH);
if (keyStorePath.equalsIgnoreCase("nginx")) {
return true;
}
if (!Paths.get(keyStorePath).isAbsolute()) {
keyStorePath = files.getDataFolder() + File.separator + keyStorePath;
}