add a flag to allow and disable sites (http.disable_sites)
This commit is contained in:
parent
94434a7522
commit
3025205063
|
@ -49,6 +49,8 @@ public class HttpServer extends AbstractLifecycleComponent<HttpServer> {
|
|||
|
||||
private final TransportNodesInfoAction nodesInfoAction;
|
||||
|
||||
private final boolean disableSites;
|
||||
|
||||
@Inject public HttpServer(Settings settings, Environment environment, HttpServerTransport transport,
|
||||
RestController restController, TransportNodesInfoAction nodesInfoAction) {
|
||||
super(settings);
|
||||
|
@ -57,6 +59,8 @@ public class HttpServer extends AbstractLifecycleComponent<HttpServer> {
|
|||
this.restController = restController;
|
||||
this.nodesInfoAction = nodesInfoAction;
|
||||
|
||||
this.disableSites = componentSettings.getAsBoolean("disable_sites", false);
|
||||
|
||||
transport.httpServerAdapter(new Dispatcher(this));
|
||||
}
|
||||
|
||||
|
@ -107,6 +111,10 @@ public class HttpServer extends AbstractLifecycleComponent<HttpServer> {
|
|||
}
|
||||
|
||||
private void handlePluginSite(HttpRequest request, HttpChannel channel) {
|
||||
if (disableSites) {
|
||||
channel.sendResponse(new StringRestResponse(FORBIDDEN));
|
||||
return;
|
||||
}
|
||||
if (request.method() != RestRequest.Method.GET) {
|
||||
channel.sendResponse(new StringRestResponse(FORBIDDEN));
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue