http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11575 Bug ID: 11575 Summary: OPACBaseURL sometimes set by ENV variable and not system preference Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: gmcharlt@gmail.com Reporter: dcook@prosentient.com.au QA Contact: testopia@bugs.koha-community.org Currently, OPACBaseURL is being set by the $ENV{'SERVER_NAME'} variable with the following code (from 2009) executed in Auth.pm's sub "get_template_and_user": OPACBaseURL => ($in->{'query'}->https() ? "https://" : "http://") . $ENV{'SERVER_NAME'} . ($ENV{'SERVER_PORT'} eq ($in->{'query'}->https() ? "443" : "80") ? '' : ":$ENV{'SERVER_PORT'}"), Basically, this checks whether or not HTTP or HTTPS was used, then uses an environmental variable to fill in the SERVER_NAME and the SERVER_PORT (if it's not 443 or 80). Unfortunately, it appears that this SERVER_NAME is set by the URL used to access Koha, rather than the ServerName provided by Apache. In many cases, this is probably fine, but it means that the OPACBaseURL can change, if you have multiple aliases or if you use an IP address to connect to Koha. Moreover, if you're using a proxy server, it seems to pick up the local domain of the proxy server and NOT the domain from the URL provided by a user. The domain from your URL will appear instead in $ENV{'HTTP_X_FORWARDED_HOST'}. I propose that we just change this variable declaration to: OPACBaseURL => ($in->{'query'}->https() ? "https://" : "http://") . C4::Context->preference("OPACBaseURL") The comments from Bug 2152 seem to indicate other times when the system preference should be used over the environmental variable as well. -- You are receiving this mail because: You are watching all bug changes.