Bug 2152 - eliminate OPACBaseURL system preference and replace with SERVER_NAME
Summary: eliminate OPACBaseURL system preference and replace with SERVER_NAME
Status: CLOSED INVALID
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: PC All
: P3 minor (vote)
Assignee: Galen Charlton
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-21 12:40 UTC by Chris Cormack
Modified: 2014-01-17 06:10 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Cormack 2010-05-21 00:47:09 UTC


---- Reported by Andrew.moore@liblime.com 2008-05-21 12:40:29 ----

The OPACBaseURL system preference should be replaced or automatically populated with the value of the $ENV{'SERVER_NAME'} environment variable. SERVER_NAME is supposed to be populated with "The server's hostname, DNS alias, or IP address as it would appear in self-referencing URLs" by apache.

This eliminates one configuration step after installation.



---- Additional Comments From rch@liblime.com 2008-05-21 14:55:34 ----


If I have a 
ServerName  and a 
ServerAlias 
in my VirtualHost directive,
will $ENV{'SERVER_NAME'}
be the url I hit the page with?
or will it be ServerName ?





---- Additional Comments From Sebastien.Hinderer@snv.jussieu.fr 2009-07-28 15:19:39 ----

Why removing this system preference ?
With the environment variable, it is not possible to set-up koha on a system where it can't have a virtual host dedicated to it.
Concretely, this means that KOha can't be installed by a non root user on a system where he only has access to addresses such as
http://host.domain.net/home/koha/
To me, the system preference is strictly more powerful than the environemnt variable.



---- Additional Comments From gmcharlt@gmail.com 2009-08-13 01:53:19 ----

Per the comment in the commit for http://bugs.koha.org/cgi-bin/bugzilla3/show_bug.cgi?id=3525 [1], there is another case where limited use of the OPACBaseURL syspref is needed after all: when the staff interface needs to link to the OPAC.

[1] http://git.koha.org/cgi-bin/gitweb.cgi?p=Koha;a=commit;h=baa0b0814919f4cb117c2ea9fcd0d726c0191bad



--- Bug imported by chris@bigballofwax.co.nz 2010-05-21 00:47 UTC  ---

This bug was previously known as _bug_ 2152 at http://bugs.koha.org/cgi-bin/bugzilla3/show_bug.cgi?id=2152

Actual time not defined. Setting to 0.0
The original reporter of this bug does not have
   an account here. Reassigning to the person who moved
   it here: chris@bigballofwax.co.nz.
   Previous reporter was Andrew.moore@liblime.com.

Comment 1 David Cook 2014-01-17 06:10:37 UTC
After some experimenting on proxied and non-proxied connections, it appears that $ENV{'SERVER_NAME'} is the domain name of the URL that a user hits the page with, and NOT the ServerName provided in the Apache configuration.

This means that the OPACBaseURL set in Auth.pm during the "get_template_and_user" call will depend on the URL that a user provided to get to that page. 

Except...when the Koha server is sitting behind a proxy server. In that case, the $ENV{'SERVER_NAME'} appears to come from the proxy server (I'm not certain what name is used...but it looks like some kind of local identifier), while $ENV{'HTTP_X_FORWARDED_HOST'} will contain the domain of the URL provided by the user.

I'm opening bug 11575 to investigate further into this.