How can I redirect all requests to https in NanoHTTPD? If I turn on the server before calling makeSecure (), then a call from the browser at http: // myserver gives an error
SEVERE: Could not send response to the client javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? at sun.security.ssl.SSLSocketImpl.checkEOF(SSLSocketImpl.java:1484) at sun.security.ssl.SSLSocketImpl.checkWrite(SSLSocketImpl.java:1496) at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:62) at fi.iki.elonen.NanoHTTPD$Response.sendBody(NanoHTTPD.java:1620) at fi.iki.elonen.NanoHTTPD$Response.sendBodyWithCorrectEncoding(NanoHTTPD.java:1593) at fi.iki.elonen.NanoHTTPD$Response.sendBodyWithCorrectTransferAndEncoding(NanoHTTPD.java:1583) at fi.iki.elonen.NanoHTTPD$Response.send(NanoHTTPD.java:1550) at fi.iki.elonen.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:952) at fi.iki.elonen.NanoHTTPD$ClientHandler.run(NanoHTTPD.java:192) at java.lang.Thread.run(Thread.java:701) How to avoid it?
try { readHttps() } catch (Any e) { readHttp() }, but there is a lot of space for a shot in the leg). - etki