mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-09-12 14:58:26 +02:00
[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:
parent
314e0a2ca7
commit
98aaff0328
@ -117,6 +117,9 @@ public class WebServer implements SubSystem {
|
|||||||
if (!usingHttps) {
|
if (!usingHttps) {
|
||||||
logger.log(L.INFO_COLOR, "§e" + locale.getString(PluginLang.WEB_SERVER_NOTIFY_HTTP_USER_AUTH));
|
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);
|
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);
|
server.createContext("/", requestHandler);
|
||||||
|
|
||||||
@ -138,6 +141,11 @@ public class WebServer implements SubSystem {
|
|||||||
|
|
||||||
private boolean startHttpsServer() {
|
private boolean startHttpsServer() {
|
||||||
String keyStorePath = config.getString(Settings.WEBSERVER_CERTIFICATE_PATH);
|
String keyStorePath = config.getString(Settings.WEBSERVER_CERTIFICATE_PATH);
|
||||||
|
|
||||||
|
if (keyStorePath.equalsIgnoreCase("nginx")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!Paths.get(keyStorePath).isAbsolute()) {
|
if (!Paths.get(keyStorePath).isAbsolute()) {
|
||||||
keyStorePath = files.getDataFolder() + File.separator + keyStorePath;
|
keyStorePath = files.getDataFolder() + File.separator + keyStorePath;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user