Passa al contenuto principale
Supporto OCLC

SPUEdit

Learn how to use the SPUEdit config.txt directive to allow EZproxy to control the starting point URL to which users are directed.

SPUEdit is a rarely used directive that allows EZproxy administrators fine-grained control over the starting point URL to which users are directed.

SPUEdit is a position-dependent, repeatable config.txt directive that interacts with AutoLoginIP, ExcludeIP, IncludeIP, and other SPUEdit directives. SPUEdit directs EZproxy to edit starting point URLs using regular expressions to allow URLs to be rearranged and then users to be rerouted to the rearranged URLs.

Qualifiers 

Qualificatore Descrizione
/ Any non-alphabetic, non-digit character
find A Perl-style regular expression to match
sostituire

The string to use to replace the expression in find. This string may contain variables including:

  • $0: matches the entire string that matched find
  • $1 through $9: based on parenthesis matching
  • ${spueditvar}: a value defined by SPUEditVar
  • e: may appear after $ to indicate that the replacement text needs to be percent-escaped as appropriate for use in URLs, such as $e0 to substitute the percent-escaped version of the find string
girs

An optional combination of letters used to indicate that:

  • g: the changes should be applied globally through the URL
  • i: the find string match  should be case-insensitive
  • r: the users should be redirected to the rewritten URL
  • s: SPUEdit processing should stop at this point

For SPUEdit to be effective, the final rule must include the redirection option (r).

Sintassi

SPUEdit / find/ replace/ girs

Esempi

The following example shows how to remap URLs that point to http://web.somedb.com and make them point to http://www.somedb.com instead:

SPUEdit @^http://web\.somedb\.com/(.*)$@http://ezproxy.yourlib.org:2048/login?url=http://www.somedb.com/$1@ir 

Note the use of @ instead of / between the find, replace, and options. If / had been used, each of the slashes that appear in the find and replace strings would need to be specified using \/ instead of just /.

Logging SPUEdit

While developing SPUEdit directives, you can add:

Option LogSPUEdit

to config.txt to direct EZproxy to record the SPUEdit manipulations of starting point URLs to messages.txt.

Varying rules based on type of IP access

An SPUEdit directive can be set to apply only if the user's IP address falls within a current AutoLoginIP, ExcludeIP, and/or IncludeIP range. To select when a rule applies, use one of:

SPUEdit -AutoLoginIP ...

SPUEdit -ExcludeIP ...

SPUEdit -IncludeIP ...

SPUEdit -AutoLoginIP -ExcludeIP ...

SPUEdit -AutoLoginIP -IncludeIP ...

SPUEdit -ExcludeIP -IncludeIP ...

In the absence of any of these qualifiers, the SPUEdit applies regardless of the type of source IP. These qualified lines are position-dependent, so they should be arranged in config.txt after relevant AutoLoginIP, ExcludeIP, and/or IncludeIP directives.