1. James Sumners
  2. JSP Web Proxy

Wiki

Clone wiki

JSP Web Proxy / Home

Introduction

JSP Web Proxy is used for allowing JavaScript programs on one domain to access content on other domains. Aside from this trivial feature, the script has two useful additions:

  1. 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.
  2. 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).

Documentation

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=example.com` or `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".

Known Problems

Currently, the mangle feature is not working properly. See issues #1 and #2.

Updated