Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] HTTP on LAN and redirect to HTTPS on WAN?

Looks like I'm close. I also want to be able to add authentication that will only apply to WAN use. Is there an easy way to do that? Authentication is set on the context which applies to both connectors.

 

                  final SslSelectChannelConnector sslCnct = new SslSelectChannelConnector(sslCnxt);

                  sslCnct.setPort(443);

                  sslCnct.setHost("0.0.0.0");

                  final SelectChannelConnector httpCnct = new SelectChannelConnector();

                  httpCnct.setPort(80);

                  httpCnct.setHost("127.0.0.1");

 

                  server.setConnectors(new Connector[] { httpCnct, sslCnct });

 

From: Will Hoover [mailto:java.whoover@xxxxxxxxx]
Sent: Thursday, September 27, 2012 10:32 AM
To: 'jetty-users@xxxxxxxxxxx'
Subject: HTTP on LAN and redirect to HTTPS on WAN?

 

What's the simplest way to setup Jetty 8 to allow HTTP on LAN and redirect to HTTPS on WAN? I have the HTTPS working, but I need to know the easiest way to allow HTTP on LAN.

 

                  final EnumSet<DispatcherType> dispatchers = EnumSet.range(

                              DispatcherType.FORWARD, DispatcherType.ERROR);

                  final ServletContextHandler context = new ServletContextHandler(

                              ServletContextHandler.SESSIONS);

                  context.setContextPath("/");

                  context.addFilter(GlobalFilter.class, "/*", dispatchers);

                  context.addServlet(DefaultAppServlet.class, "/");

 

 

 

 


Back to the top