LP#1648234 Retain myopac redirect and keep refs
authorBill Erickson <berickxx@gmail.com>
Wed, 3 May 2017 14:48:49 +0000 (10:48 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Thu, 11 May 2017 18:44:00 +0000 (14:44 -0400)
Leave the myopac.xml redirect in eg_vhost.conf since of all the
redirects it's the most likely to be used.  This version of the redirect
is proxy-proofed.

Additionally keep all of the original myopac redirects in
Open-ILS/examples/jspac_redirects.conf for reference.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Ben Shum <ben@evergreener.net>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/examples/apache/eg_vhost.conf.in
Open-ILS/examples/apache_24/eg_vhost.conf.in
Open-ILS/examples/jspac_redirects.conf [new file with mode: 0644]
docs/RELEASE_NOTES_NEXT/Administration/remove-jspac-redir.adoc

index 992e41f..a413821 100644 (file)
@@ -129,6 +129,12 @@ RewriteRule . - [E=OILS_OPAC_RID:%2,E=OILS_TIME_YEAR:%{TIME_YEAR}]
 RewriteCond %{REQUEST_URI} ^/opac/(.*?)/
 RewriteRule . - [E=locale:%1]
 
+# ----------------------------------------------------------------------------------
+# Rewrite JSPac->TPac with redirects
+# ----------------------------------------------------------------------------------
+# My Account
+RewriteRule /opac/[^/]*/skin/default/xml/myopac.xml %{ENV:REQUEST_SCHEME}://%{HTTP_HOST}/eg/opac/myopac/main?%{ENV:OILS_JSPAC_SEARCH_TYPE}%{ENV:OILS_JSPAC_SEARCH_TERMS}%{ENV:OILS_JSPAC_SEARCH_LOCATION} [NE,R,L]
+
 # -----------------------------------------------------------------------------$
 # Force HTTPS for /eg/circ/selfcheck
 # -----------------------------------------------------------------------------$
index 45c5424..5821c28 100644 (file)
@@ -120,6 +120,12 @@ RewriteRule . - [E=OILS_OPAC_RID:%2,E=OILS_TIME_YEAR:%{TIME_YEAR}]
 RewriteCond %{REQUEST_URI} ^/opac/(.*?)/
 RewriteRule . - [E=locale:%1]
 
+# ----------------------------------------------------------------------------------
+# Rewrite JSPac->TPac with redirects
+# ----------------------------------------------------------------------------------
+# My Account
+RewriteRule /opac/[^/]*/skin/default/xml/myopac.xml %{REQUEST_SCHEME}://%{HTTP_HOST}/eg/opac/myopac/main?%{ENV:OILS_JSPAC_SEARCH_TYPE}%{ENV:OILS_JSPAC_SEARCH_TERMS}%{ENV:OILS_JSPAC_SEARCH_LOCATION} [NE,R,L]
+
 # -----------------------------------------------------------------------------$
 # Force HTTPS for /eg/circ/selfcheck
 # -----------------------------------------------------------------------------$
diff --git a/Open-ILS/examples/jspac_redirects.conf b/Open-ILS/examples/jspac_redirects.conf
new file mode 100644 (file)
index 0000000..d38e975
--- /dev/null
@@ -0,0 +1,43 @@
+# ----------------------------------------------------------------------------------
+# Apache RewriteRule's for redirecting old-school JSPAC URLs to TPAC URLs.
+# To use these redirects, add them to eg_vhost.conf, typically found at
+# /etc/apache2/eg_vhost.conf
+# See also https://bugs.launchpad.net/evergreen/+bug/1648234
+# ----------------------------------------------------------------------------------
+
+# Basic (overall) search type, if present
+# I am cheating and grabbing RT or TP because I dunno the difference between them.
+RewriteCond %{REQUEST_URI} ^/opac/
+RewriteCond %{QUERY_STRING} (^|[^0-9a-zA-Z])(rt|tp)=([^;&]*)
+RewriteRule . - [E=OILS_JSPAC_SEARCH_TYPE:qtype=%3;]
+
+# Basic (overall) search term(s), if present - NOTE: Not doing advanced search.
+RewriteCond %{REQUEST_URI} ^/opac/
+RewriteCond %{QUERY_STRING} (^|[^0-9a-zA-Z])t=([^;&]*)
+RewriteRule . - [E=OILS_JSPAC_SEARCH_TERMS:query=%2;]
+
+# Search Location, if present
+RewriteCond %{REQUEST_URI} ^/opac/
+RewriteCond %{QUERY_STRING} (^|[^0-9a-zA-Z])l=([^;&]*)
+RewriteRule . - [E=OILS_JSPAC_SEARCH_LOCATION:locg=%2;]
+
+# My Account
+RewriteRule /opac/[^/]*/skin/default/xml/myopac.xml /eg/opac/myopac/main?%{ENV:OILS_JSPAC_SEARCH_TYPE}%{ENV:OILS_JSPAC_SEARCH_TERMS}%{ENV:OILS_JSPAC_SEARCH_LOCATION} [NE,R,L]
+
+# Record Pages
+# /opac/en-US/skin/default/xml/rdetail.xml?r=32 -> /eg/opac/record/32
+RewriteCond %{QUERY_STRING} (^|[^0-9a-zA-Z])r=([^;&]*)
+RewriteRule /opac/.*/rdetail.xml /eg/opac/record/%2?%{ENV:OILS_JSPAC_SEARCH_TYPE}%{ENV:OILS_JSPAC_SEARCH_TERMS}%{ENV:OILS_JSPAC_SEARCH_LOCATION} [NE,R,L]
+
+# Bookbag Pages
+# /opac/extras/feed/bookbag/html-full/1 -> /eg/opac/results?bookbag=1;page=0;locg=1;depth=0
+RewriteRule /opac/extras/feed/bookbag/html-full/(\d*) /eg/opac/results?bookbag=$1;%{ENV:OILS_JSPAC_SEARCH_TYPE}%{ENV:OILS_JSPAC_SEARCH_TERMS}%{ENV:OILS_JSPAC_SEARCH_LOCATION} [NE,R,L]
+
+# Search Results Pages
+RewriteRule /opac/[^/]*/skin/[^/]*/xml/rresult.xml /eg/opac/results?%{ENV:OILS_JSPAC_SEARCH_TYPE}%{ENV:OILS_JSPAC_SEARCH_TERMS}%{ENV:OILS_JSPAC_SEARCH_LOCATION} [NE,R,L]
+
+# Basic Search (STILL not doing advanced)
+# Fallback! But only for things that end in xml, htm, or html
+# Images, CSS, etc can stick around.
+RewriteRule /opac/[^/]*/skin/.*(xml|htm|html|/)$ /eg/opac/home?%{ENV:OILS_JSPAC_SEARCH_TYPE}%{ENV:OILS_JSPAC_SEARCH_TERMS}%{ENV:OILS_JSPAC_SEARCH_LOCATION} [NE,R,L]
+
index 8c43ea3..e017279 100644 (file)
@@ -1,8 +1,10 @@
 Remove JSPAC Redirects
 ^^^^^^^^^^^^^^^^^^^^^^
-Future versions of Evergreen will no longer contain automatic redirects 
-from JSPAC URLs to TPAC URLs, given that the JSPAC is no longer supported.
-Existing sites, however, may wish to retain JSPAC redirects in their 
-Apache configuration files since JSPAC URLs may still be used in the wild 
-to access their catalogs.
+Future versions of Evergreen will no longer contain automatic redirects
+from JSPAC URLs to TPAC URLs, with the exception of myopac.xml, given
+that the JSPAC is no longer supported.  Existing sites, however, may
+wish to retain JSPAC redirects in their Apache configuration files since
+JSPAC URLs may still be used in the wild to access their catalogs.
 
+The original JSPAC URL redirects are all retained in the file 
+Open-ILS/examples/jspac_redirects.conf for reference.