- The script can imitate the user that is viewing the page which initiated the call to the proxy. It does this by passing along the user's "User Agent" string and his "cookie" header.
- The script can alter links in the retrieved content to make them request data through the proxy. This allows you to "fix" mixed content warnings (e.g. when you pull HTTP data into an HTTPS served page).
There are several parameters that can be passed to the script:
- "p_url" (required): This parameter specifies the resource the proxy should fetch.
- "p_mimetype" (optional [Default: "text/html"]): This specifies the mimetype the proxy should respond with.
- "p_act_as_client" (optional): If present, and not null, then the proxy will pretend to be client. It will pass along the client's user agent and cookies.
- "p_mangle" (optional): If present, and not null, then any `src` attributes in the fetched content will be re-written to pass through the proxy.
You can pass
`p_url=http%3A%2F%2Fexample.com` (URI Component Encoded)
to fetch data from `example.com`. If you do not specify the scheme ("http" or "https"), then
the proxy will use the scheme it was requested through. That is,
`http://localhost/proxy.jsp?p_url=example.com` will result in a fetch URL of
`http://example.com`. This will affect mangled data. As a consequence, the remote
server should support SSL. Otherwise, you will get an IOException.
If the resource you are fetching requires parameters of its own, you can append them
as parameters to the proxy request. Any parameter that the proxy does not recognize
as its own will be passed along to the remote request. So if you do
`http://localhost/proxy.jsp?p_url=google.com&q=bricks`, you will get back the Google
search results for the query "bricks".