Override sysprefs in Apache config

From Koha Wiki
Jump to navigation Jump to search

It is possible to override specific system preferences in the Apache config. This enables things like:

  • Multiple OPACs with different CSS
  • Multiple OPACs with different default search limits
  • Self check out with different users for different libraries

Examples

On an installation using the Debian packages, your site specific Apache config file will be located at:

 /etc/apache2/sites-enabled/<instance>.conf

Add something like the following to set up SCO with a given user and password:

RequestHeader add X-Koha-SetEnv "OVERRIDE_SYSPREF_AutoSelfCheckAllowed 1"
RequestHeader add X-Koha-SetEnv "OVERRIDE_SYSPREF_AutoSelfCheckID xyz"
RequestHeader add X-Koha-SetEnv "OVERRIDE_SYSPREF_AutoSelfCheckPass abc"

To limit search to the "MYLIB" library:

RequestHeader add X-Koha-SetEnv "OPAC_SEARCH_LIMIT branch:MYLIB"
RequestHeader add X-Koha-SetEnv "OPAC_LIMIT_OVERRIDE 1"

An example for using different self-check users depending on the client IP (with Apache 2.4):

 <If "-R 'CLIENT_OR_NET_IP_HERE'">
   # Koha without Plack
   SetEnv OVERRIDE_SYSPREF_AutoSelfCheckID "xyz"
   SetEnv OVERRIDE_SYSPREF_AutoSelfCheckPass "abc"
 
   # Koha with Plack
   # (commas must be escaped with '\')
   RequestHeader add X-Koha-SetEnv "OVERRIDE_SYSPREF_AutoSelfCheckID xyz"
   RequestHeader add X-Koha-SetEnv "OVERRIDE_SYSPREF_AutoSelfCheckPass abc"
 </If>

See also