Search code examples
http-proxy

How to implement authentication in a Proxy Server


I borrowed code for an http proxy server, everything works fine. Now I want to limit use of the proxy server by requiring authentication.

So, I tried the following:

On the client side:

  1. web client created to request page from google.
  2. web client uses WbProxy with username and password.

on the server, the request comes through, and I can see the headers:

So I have the server respond to the client with:

  • HTTP/1.0 407 Proxy Authentication Required
  • Proxy-Authenticate: Basic realm="proxy"

At this point, I was hoping the client would then respond with the username and password used for the WebProxy credentials. But that doesn't happen.

What am I missing? How do I get my Proxy server to require authentication and ultimately to test the credentials sent?


Solution

  • I figured it out, had to add "\r\n\r\n" to the response back to the client. LAME!