简体   繁体   中英

Intercept http request/response

I have been tasked to work on a kind of parental control website.

The user would enter a url on the site and press "Go". The control website would then act like a filter between the client and the requested site, doing minimal processing on the response before letting it through to the client.

Example: A person browses to the Control site, enter the url of an external site. The control site would then do the request on behalf of the browser and process the response before relaying it back to the browser. I would assume that I would have to modify all links/references too to make them point back to the control site again otherwise when the client clicks on a link it would bypass the control server.

I have little clue if this is even possible, i tried to research it online but did not find anything useful. The web server at my disposal supports jsp so if possible that's what this has to be implemented in.

I did experiment using HttpURLConnection and although I managed to relay the raw html back to the client all the links (images, css, js) were broken. I guess they were all relative to the control server but i was not able to change that.

Firstly you should ask yourself why reinvent the wheel? There are many existing parental control solution out there. Most modern routers even includes a parental control features.

Secondly, I would say HttpURLConnection is somewhat wrong direction. You have to ask how could your user not circumvent your software at network level. You potentially have to take control of Firewall / DNS as the first step.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM