title: Jetty Transparent Proxy - add Userinfo
body: <p>I've successfully created a transparent proxy using jetty 9 with the following servlet code:</p>
  
  <pre><code>public class ProxyRewriteServlet extends ProxyServlet.Transparent {
     private static final String HOST = "192.168.1.20" // 'hidden' server
     private static final int PORT = 28000 // the port the server is listening to
  
     @Override
     protected URI rewriteURI(HttpServletRequest request) {
         URIBuilder builder = new URIBuilder()
          .setScheme("http").setHost(HOST).setPort(PORT)
          .setPath(request.getRequestURI());
  
        return builder.build();
     }
  </code></pre>
  
  <p>The proxy forwards to a well-known server (192.168.1.20) which requires basic authentication. A direct access to the server with the address <code><a href="http://admin:password@192.168.1.20/path" rel="nofollow">http://admin:password@192.168.1.20/path</a></code> works. An access over the proxy <code><a href="http://admin:password@proxy.from.above/path" rel="nofollow">http://admin:password@proxy.from.above/path</a></code> works as well.</p>
  
  <p>However, accessing over <code><a href="http://proxy.from.above/path" rel="nofollow">http://proxy.from.above/path</a></code> does not work because of the authentication. Therefore I complement <code>rewriteURI()</code> with the following:</p>
  
  <pre><code>builder.setUserInfo("admin", "password"); 
  </code></pre>
  
  <p>Unfortunately, this does not have any effect and the server asks the browser to enter the credentials.</p>
  
  <p>Is there a proper way to inject the user info at the proxy? Or do they necessarily need to come from the client?</p>