title: How can I get Tomcat (etc) to accept HTTPS proxy requests?
body: <p>I'm trying to create a proxy in Java which proxies HTTP and HTTPS URLs. (I'm using Tomcat 8.0.14. I have set up Tomcat to <em>receive</em> HTTPS connections on port 8443, although this shouldn't be necessary to use Tomcat as an HTTPS proxy. But either way I get the same behaviour.) I've got it working using HTTP, but when I use HTTPS, it seems that Tomcat just rejects the connection and doesn't even call my servlet.</p>
  
  <p>To illustrate this, I've created an example "Hello World" servlet mapped to "/*" in my web.xml.</p>
  
  <pre><code>public class HelloWorldProxy extends HttpServlet {
      @Override
      public void service(ServletRequest req, ServletResponse res)
              throws ServletException, IOException {
          System.out.println("Hello, World! " + ((new Date()).toString()));
          super.service(req, res);
      }
  }
  </code></pre>
  
  <p>I set "localhost:8080" as the proxy for HTTP and HTTPS requests in Firefox as a test. Behaviour:</p>
  
  <ul>
  <li>When I hit "<a href="http://www.bbc.co.uk/" rel="nofollow">http://www.bbc.co.uk/</a>", I get "Hello, World! ...." in the console as expected.</li>
  <li>When I hit "<a href="https://github.com/" rel="nofollow">https://github.com/</a>", I don't get any console output.</li>
  </ul>
  
  <p>Does anyone know why this is?</p>