Hi All, I am dealing with a Proxy Assignment that
1) Uses a FireFox Browser --> Send request to Proxy (My program) --> Forward Request to HTTP Server
2) HTTP Server ---> Respond to Proxy (My Program) ---> Respond send back to FireFox Browser to load page
This is my code :
This is my Output :
Creating server socket on port 8128
Accepted connection from /127.0.0.1
null
Accepted connection from /127.0.0.1
GET
http://stackoverflow.com/questions/12900825/how-do-i-forward-the-http-request-back-to-the-browser-proxy-java HTTP/1.0
Host: stackoverflow.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: close
Proxy-Connection: close
Pragma: no-cache
After getting this information, i have trouble forwarding this back to the browser to load the page. Am not sure whats wrong, i tried opening another socket but it doesnt seems to work.