GeoServer Proxy Extension

GeoServer has a community module that allows the creation of a proxy. With this, a user can route an HTTP request to an arbitrary server. The proxy is configurable to restrict requests to specific hosts and MIMEtypes.

The Same Origin Policy can make JavaScript development tricky. The proxy is designed to work around this.

How it works

Send a request to:

http://[your_geoserver_domain]/geoserver/rest/proxy?url=[your url]

The proxy will send your request through if permitted by its rules, or return an error otherwise.

Rules

The proxy enforces the following rules to determine whether a packet is allowed through:

  1. Check if the HTTP request is grabbing content of one of the permitted MIMEtypes.
  2. Check if the request is to a host specified as permitted by a user through a web interface.

If the request meets either of these criteria, it will be routed through.

There are also ways to set the proxy to only allow packets that meet both criteria through. Those settings can only be changed by manually editing a configuration file.

Installation

  1. Install GeoServer 2.0-beta2 or newer (a Nightly will work as well), installed in a directory to be referred to as GEOSERVER_HOME.
  2. Download the attached JAR containing the proxy.
  3. Copy the file into $GEOSERVER_HOME/webapps/geoserver/WEB-INF/lib .
  4. Restart GeoServer
  5. Go to the "Proxy Admin Page" in the GeoServer Web UI.
  6. Add any hostnames you wish to permit redirection to.
  7. Change the default MIMETypes, which are those often returned by requests to OGC protocols, as appropriate for your deployment.
See http://en.wikipedia.org/wiki/Hostname for hostname information. Note that hostnames do not contain "http://", nor can they contain any slashes. Note also that "geoserver.org" and "www.geoserver.org" are different hostnames.

The proxy will now be active. Send requests through

http://[your_geoserver_domain]/geoserver/rest/proxy?url=[your url].

Make sure to include a full and absolute URL, such as:

http://[your_geoserver_domain]/geoserver/rest/proxy?url=http://www.google.com

Also make sure the URL is URL-encoded.

Added by Alan Gerber, last edited by Mike Pumphrey on Jul 30, 2009  (view change)
View Attachments (2) Info