Skip to main content
OCLC Support

HostJavaScript (HJ)

Learn how to use the HostJavaScript config.txt directive to specify a protocol/host/port to be written by EZproxy and the additional JavaScript processing to occur for pages proxied from the corresponding server.

HostJavaScript (also written as HJ) specifies a specific protocol/host/port which should be rewritten by EZproxy and that additional JavaScript processing should occur for pages proxied from the corresponding server. If http:// and https:// are both omitted, then EZproxy assumes that the protocol is http. If port is omitted, the default is 80 for http or 443 for https.

When EZproxy proxies content, it normally rewrites URLs that appear within the HTTP header and within HTML tags that accept URLs, but nothing else. If a server matches HostJavaScript, when content is retrieved from host using the corresponding protocol and port, EZproxy will perform additional processing to rewrite anything that appears to be a URL in any retrieved content that is identified as being HTML, JavaScript, or XML.

The HostJavaScript directive also authorizes the specified protocol/host/port for use in Starting Point URLs, similar to the behavior of the URL directive.

If a database stanza contains both a Host and HostJavaScript directive for the same protocol/host/port, HostJavaScript takes priority and enables additional processing.

Qualifiers

Qualifier Description
host Name of the host to authorize for proxying.

Options

Option Description
http://

May appear in front of the hostname to indicate that http should be used. This value is the assumed value unless https:// is specified.

https:// Must appear in front of the hostname if the host should be proxied using https.
port Specified remote port to authorize for proxying. If unspecified, defaults to 80 for http and 443 for https.
listenport Specific local port to associate with this host. This option is primarily intended to assign a fixed port for use in proxy by port. When used with proxy by hostname, it specifies that the hostname should not be rewritten, and instead this host should be proxied using the base name of the EZproxy server on the specified port.

Syntax

https:// host[:port] [listenport]

Examples

Direct EZproxy to proxy access to http://www.somedb.com with extra JavaScript processing enabled. In this example, proxying would not be available to other URLs within the somedb.com domain.

Title Some Database
URL http://www.somedb.com
HJ www.somedb.com

Related directives

Domain, DomainJavaScript, Host, URL