java - How to use Jetty IPAccessHandler to whitelist IPv6 addresses? -
i want jetty server handle requests coming localhost. attempting by:
servletcontexthandler context = new servletcontexthandler(servletcontexthandler.sessions); context.setcontextpath("/webapi"); ipaccesshandler ipblockinghandler = new ipaccesshandler(); ipblockinghandler.addwhite("127.0.0.1|/*"); ipblockinghandler.sethandler(context); final org.eclipse.jetty.server.server jettyserver = new org.eclipse.jetty.server.server(8080); jettyserver.sethandler(ipblockinghandler);
though, works ipv4 , if add ipblockinghandler.addwhite("127.0.0.1|/*");
not work.
this doable overriding ipaccesshandler , manually parsing adddresses:
ipaccesshandler ipblockinghandler = new ipaccesshandler(){ @override protected boolean isaddruriallowed(string addr, string path){ return addr.equals("127.0.0.1") || addr.equals("0:0:0:0:0:0:0:1"); } };
Comments
Post a Comment