HDL.NET® Proxy Server System

 

CNRI runs a proxy server system at https://hdl.handle.net/. This HANDLE.NET Service is a collection of web servers that understand the handle protocol. Many implementations of handles intended to help manage web content embed the handles in URLs on web pages, and for the convenience of their customers, use the proxy server for resolution.

CNRI's proxy server uses the HDL.NET proxy servlet code that is available for download here.

 

1. Resolving Handles Using the Proxy Server System

For any HTTP request that combines the proxy's domain name with a handle, for example

https://hdl.handle.net/20.1000/5555

one of the proxy servers will query for the handle, take the URL in the handle record (or if there are multiple URLs in the handle record it will select one, and that selection is in no particular order) and send an HTTP redirect to that URL to the user's web browser. If there is no URL value, the proxy will display the handle record.

In addition to handle values of type URL, the proxy server understands values of handle value type 10320/loc. These values contain XML describing multiple redirection endpoints for the handle and conditions under which the proxy should use them. For further documentation see the Technical Manual.

The proxy server displays a "Handle Not Found" error page when queried for a handle that it cannot find.

The handles 20.1000/5555 and 20.1000/5555/ are both valid handles, but it is unusual for a handle to have trailing slash. If a resolution request for a handle with a trailing slash is received by the proxy server and that handle is not found, the proxy server will return an error report that includes a warning that the requested handle contained a trailing slash, and a link to click to resolve the same string without the slash.

To speed resolution, the proxy servers cache handle values, with the TTL typically set to 24 hours. This means that if a handle value is changed, it can take up to 24 hours before the new value is returned.

 

2. Encoding Handles for Use in URIs

The Handle System® uses UTF-8, a Unicode implementation, and has no character set constraints. But the proxy server is a web server that sends redirects to web browsers using HTTP syntax, so characters in handles that may not be interpreted correctly by web browsers, for example '?', should be avoided or encoded. A non-ASCII character in a handle should be converted to UTF-8, and each UTF-8 byte that isn't ASCII should be percent-encoded.

The "#" is another example. Only if you send the proxy server the handle

20.1000/5555#resolve

encoded as

https://hdl.handle.net/20.1000/5555%23resolve

will the proxy correctly resolve the handle. If it is not encoded, #resolve will be treated as a fragment and removed by the web browser before it gets to the proxy, which will then attempt to resolve 20.1000/5555 instead.

The following characters, at least, require percent-encoding:

Character Encoding
% %25
# %23
SPACE %20
? %3F

Note also that web browser treatment of "/./" and "/../" can be inconsistent. It is recommended that one of the slashes be percent encoded, e.g., change "/./" to "/.%2F" and "/../" to "/..%2F".

 

3. Proxy Server Query Parameters

noredirect
Do not redirect using URL or 10320/loc values; display handle values instead.
ignore_aliases
Ordinarily the proxy will take a handle value of type HS_ALIAS to be a handle that should be resolved instead of the input handle; with this parameter values of type HS_ALIAS are ignored.
auth
Authoritative query. The proxy will bypass its cache and resolve the handle at an authoritative server.
cert
Certified query. The proxy will require an authenticated response from the handle server. Not generally needed by end users.
index
Only resolve the handle value at the specified index. May be repeated to resolve multiple indices.
type
Only resolve handle values of the specified type. May be repeated to resolve multiple types.
urlappend
The value of this parameter is appended to the end of the URL used for redirection.
locatt=key:value
For multiple redirection; specifies a key:value pair to determine the choice of redirection from 10320/loc values.
action=showurls
For multiple redirection; returns an XML representation of the possible redirect locations.
 

4. Proxy Server REST API

The handle proxy REST API allows programmatic access to handle resolution using HTTP.

Example Request/Response

A REST API request can be made by performing a standard HTTP GET of

/api/handles/<handle>

The API returns JSON.

For example, https://hdl.handle.net/api/handles/4263537/4000 yields the response

{
   "responseCode":1,
   "handle":"4263537/4000",
   "values":[
      {
         "index":100,
         "type":"HS_ADMIN",
         "data":{
            "format":"admin",
            "value":{
               "handle":"0.NA/4263537",
               "index":200,
               "permissions":"011111111111"
            }
         },
         "ttl":86400,
         "timestamp":"2000-04-10T22:41:46Z"
      },
      {
         "index":1,
         "type":"URL",
         "data":{ "format":"string", "value":"https://www.handle.net/index.html" },
         "ttl":86400,
         "timestamp":"2001-11-21T16:21:35Z"
      },
      {
         "index":2,
         "type":"EMAIL",
         "data":{ "format":"string", "value":"hdladmin@cnri.reston.va.us" },
         "ttl":86400,
         "timestamp":"2000-04-10T22:41:46Z"
      }
   ]
}
 

Response Format

The response is a JSON object which includes a "responseCode" (an integer referring to a Handle protocol response code), an echo of the "handle" resolved, and either a list of "values" or, in the case of an error, an optional "message" which is a string describing the error.

Each value is a JSON object with generally 5 attributes:

Handle value data is an object with properties "format", a string, and "value".

 

Response Codes

 

Query Parameters

This proxy server system REST API is CORS-compliant, however, JSONP callbacks are also supported using a "callback" query parameter.

The presence of the "pretty" query parameter instructs the server to pretty-print the JSON output.

The "auth" query parameter instructs the proxy server to bypass its cache and query a primary handle server directly for the newest handle data.

The "cert" query parameter instructs the proxy server to request an authenticated response from the source handle server. Not generally needed by end users.

The "type" and "index" query parameters allow the resolution response to be restricted to specific types and indexes of interest. Multiple "type" and "index" parameters are allowed and values are returned which match any of the specified types or indexes. For example,

For example, https://hdl.handle.net/api/handles/4263537/4000?type=URL&type=EMAIL&callback=processResponse yields the response

processResponse({
   "responseCode":1,
   "handle":"4263537/4000",
   "values":[
      {
         "index":1,
         "type":"URL",
         "data":{ "format":"string", "value":"https://www.handle.net/index.html" },
         "ttl":86400,
         "timestamp":"2001-11-21T16:21:35Z"
      },
      {
         "index":2,
         "type":"EMAIL",
         "data":{ "format":"string", "value":"hdladmin@cnri.reston.va.us" },
         "ttl":86400,
         "timestamp":"2000-04-10T22:41:46Z"
      }
   ]
});

-

5. Proxy Servlet (ver. 9.3.1) — Java™ Version

The proxy servlet code is for developers who want to set up their own proxy server. This is server software, not a web browser plug-in.

It is implemented as a Java servlet and typically runs under the Apache Tomcat servlet environment.

The HTTP-to-Handle servlet enables handle resolution via a web browser. It accepts HTTP GET requests for handles, resolves those handles, and returns an HTTP redirect to the URL value associated with the handle (or randomly chooses one of the URL values if there is more than one).

-

This software is being made available under the CNRI License Agreement for Proxy Servlet (ver. 9.3.0) — Java™ Version. Please read the license carefully and agree to the terms before downloading the software.

February 2, 2023