Bugzilla – Attachment 25601 Details for
Bug 11575
OPACBaseURL sometimes set by ENV variable and not system preference
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED OFF] Bug 11575 - OPACBaseURL sometimes set by ENV variable and not system preference
SIGNED-OFF-Bug-11575---OPACBaseURL-sometimes-set-b.patch (text/plain), 3.68 KB, created by
Mark Tompsett
on 2014-02-25 05:26:45 UTC
(
hide
)
Description:
[SIGNED OFF] Bug 11575 - OPACBaseURL sometimes set by ENV variable and not system preference
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2014-02-25 05:26:45 UTC
Size:
3.68 KB
patch
obsolete
>From b335a96918b32e159b34f01354eee6e5a67c9cd5 Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Mon, 20 Jan 2014 11:54:26 +1100 >Subject: [PATCH] [SIGNED OFF] Bug 11575 - OPACBaseURL sometimes set by ENV > variable and not system preference > >This patch changes how the OPACBaseURL parameter gets set in the subroutine >get_template_and_user in Auth.pm. > >Currently, it's being set by the $ENV{'SERVER_NAME'} variable, which is >typically filled by the URL that the user uses to access a page. While this >works in many cases, this causes a problem when using a proxy server. The >SERVER_NAME will instead be the domain of the proxy server (for more >info, read the comments already on this bug on Bugzilla). There are >ways to compensate for proxy servers. However, such a solution seems >a bit convoluted... > >Elsewhere in Koha, we use the system preference OPACBaseURL, so I think >it makes sense to use it here as well. > >I did leave the $ENV{'SERVER_NAME'} as a full back if OPACBaseURL isn't >set, but that's it. > >_TEST PLAN_ > >Before applying: > >1) Clear your OPACBaseURL preference >2) Perform a search in the OPAC >3) Click on or hover over the orange RSS icon >4) Note that the URL you used to access the site is the URL used >for the RSS link >5) Add an OPACBaseURL that isn't the same as the actual OPAC URL >6) Note that the OPACBaseURL system preference has no effect here > >After applying the patch: > >7) Refresh the page >8) Note that the URL you see now is actually the OPACBaseURL system >preference that you set >9) Clear your OPACBaseURL system preference >10) Refresh your search page >11) Note that the URL has reverted back to the URL that you used >to access the page > >Followed test plan, worked as expected. I have my apache >redirecting HTTP to HTTPS, and put my IP address in URL which >did trigger the OPAC as expected. The IP address was in the RSS >link as the test predicted after the patch. HTTPS in both cases. > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> >--- > C4/Auth.pm | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index 44edf67..de00bad 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -387,6 +387,10 @@ sub get_template_and_user { > } elsif (C4::Context->preference("SearchMyLibraryFirst") && C4::Context->userenv && C4::Context->userenv->{'branch'}) { > $opac_name = C4::Context->userenv->{'branch'}; > } >+ my $opac_base_url = C4::Context->preference("OPACBaseURL"); >+ if (!$opac_base_url){ >+ $opac_base_url = $ENV{'SERVER_NAME'} . ($ENV{'SERVER_PORT'} eq ($in->{'query'}->https() ? "443" : "80") ? '' : ":$ENV{'SERVER_PORT'}"); >+ } > $template->param( > opaccolorstylesheet => C4::Context->preference("opaccolorstylesheet"), > AnonSuggestions => "" . C4::Context->preference("AnonSuggestions"), >@@ -407,8 +411,7 @@ sub get_template_and_user { > OPACMobileUserCSS => "". C4::Context->preference("OPACMobileUserCSS"), > OPACViewOthersSuggestions => "" . C4::Context->preference("OPACViewOthersSuggestions"), > OpacAuthorities => C4::Context->preference("OpacAuthorities"), >- OPACBaseURL => ($in->{'query'}->https() ? "https://" : "http://") . $ENV{'SERVER_NAME'} . >- ($ENV{'SERVER_PORT'} eq ($in->{'query'}->https() ? "443" : "80") ? '' : ":$ENV{'SERVER_PORT'}"), >+ OPACBaseURL => ($in->{'query'}->https() ? "https://" : "http://") . $opac_base_url, > opac_css_override => $ENV{'OPAC_CSS_OVERRIDE'}, > opac_search_limit => $opac_search_limit, > opac_limit_override => $opac_limit_override, >-- >1.7.9.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 11575
:
24556
|
25601
|
28856
|
28857
|
28987
|
29101