Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #5721

Re: HTTP traffic over a custom proxy server?

Date 2011-06-28 09:22 +0200
From Silvio <silvio@moc.com>
Newsgroups comp.lang.java.programmer
Subject Re: HTTP traffic over a custom proxy server?
References <60701286-eb78-421a-8d54-b48762480994@glegroupsg2000goo.googlegroups.com>
Message-ID <4e09812e$0$4358$e4fe514c@news.xs4all.nl> (permalink)

Show all headers | View raw


On 06/24/2011 12:24 PM, Knorpi wrote:
> Hi,
>
> I would like to setup a server "myserver" that acts as a proxy for its clients. The clients pass the url of the web page they want in a query string:
>
> - client sends a HTTP request:
>    http://myserver?url=www.foreignurl.com&par2=val1
>
> - Servlet on myserver extracts url from query string:
>    www.foreignurl.com
>
> - Servlet sends HTTP request to other server with query string:
>    http://www.foreignurl.com?par1=val1

Sounds like a proxy on drugs...

>
> - Servlet renders complete response from other server
>    into a String "content"
>
> - Servlet changes every link in the content to point to myserver
>    so that all links are accessed the same way

This is not generally possible. A page might use JavaScript to generate 
URLs dynamcally and you would not be able to hook into that.

You can use the <base href="..."/> tag for achieving something similar 
for relative URLs.

Ceating a proper proxy and setting it as the proxy for the user agents 
would solve this automatically.

Silvio


>
> - Servlet sends response to client
>
> The most important part would be to change all links in the response.
> Can you give me some hints how to do this?
>
> Thanks
> Magnus

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Find similar


Thread

HTTP traffic over a custom proxy server? Knorpi <alpineblaster@googlemail.com> - 2011-06-24 03:24 -0700
  Re: HTTP traffic over a custom proxy server? Tom Anderson <twic@urchin.earth.li> - 2011-06-25 23:49 +0100
  Re: HTTP traffic over a custom proxy server? Roedy Green <see_website@mindprod.com.invalid> - 2011-06-25 16:08 -0700
  Re: HTTP traffic over a custom proxy server? Esmond Pitt <esmond.pitt@bigpond.com> - 2011-06-27 20:28 +1000
  Re: HTTP traffic over a custom proxy server? Silvio <silvio@moc.com> - 2011-06-28 09:22 +0200

csiph-web