Fixes the mixed content warnings from IE7 and IE8 "out of the box" without
breaking sites that use static servers for CSS and Javascript.
This sets OILS_PROTOCOL based on the environment variable HTTPS (which
Apache sets to "on" for https:// requests).
Thus, a page loaded via https:// gets https:// urls, and a page loaded via
http:// gets http:// urls.
To accommodate sites with static servers that can not support https,
there's a new OILS_OPAC_STATIC_PROTOCOL variable in eg_vhost.conf
which can be set to "http" to force JS/CSS to be loaded over http://
(you'll get the same warnings that you got before).
git-svn-id: svn://svn.open-ils.org/ILS/trunk@13288
dcc99617-32d9-48b4-a31d-
7c20da2025e4
SetEnvIf Request_URI ".*" OILS_OPAC_BASE=/opac/
# This gives you the option to configure a different host to serve OPAC images from
- # Specify the hostname (withouth protocol) and path to the images. Protocol will
+ # Specify the hostname (without protocol) and path to the images. Protocol will
# be determined at runtime
#SetEnvIf Request_URI ".*" OILS_OPAC_IMAGES_HOST=static.example.org/opac/
+
+ # In addition to loading images from a static host, you can also load CSS and/or
+ # Javascript from a static host or hosts. Protocol will be determined at runtime
+ # and/or by configuration options immediately following.
#SetEnvIf Request_URI ".*" OILS_OPAC_CSS_HOST=static.example.org/opac/
#SetEnvIf Request_URI ".*" OILS_OPAC_JS_HOST=static.example.org/opac/
+ # If you are not able to serve static content via https and
+ # wish to force http:// (and are comfortable with mixed-content
+ # warnings in client browsers), set this:
+ #SetEnvIf Request_URI ".*" OILS_OPAC_STATIC_PROTOCOL=http
+
+ # If you would prefer to fall back to your non-static servers for
+ # https pages, avoiding mixed-content warnings in client browsers
+ # and are willing to accept some increased server load, set this:
+ #SetEnvIf Request_URI ".*" OILS_OPAC_BYPASS_STATIC_FOR_HTTPS=yes
+
</LocationMatch>
function buildISBNSrc(isbn, size) {
size = (size) ? size : 'small';
+ var protocol = (OILS_OPAC_STATIC_PROTOCOL) ? OILS_OPAC_STATIC_PROTOCOL + ':' : location.protocol;
if(OILS_OPAC_IMAGES_HOST)
- return location.protocol + '//' + OILS_OPAC_IMAGES_HOST + size + '/' + isbn;
+ return protocol + '//' + OILS_OPAC_IMAGES_HOST + size + '/' + isbn;
return '../../../../extras/ac/jacket/'+size+'/'+isbn;
}
<!--#if expr="$OILS_OPAC_IMAGES_HOST"-->
OILS_OPAC_IMAGES_HOST = '<!--#echo var="OILS_OPAC_IMAGES_HOST"-->extras/ac/jacket/';
<!--#endif -->
+ var OILS_OPAC_STATIC_PROTOCOL = null;
+ <!--#if expr="$OILS_OPAC_STATIC_PROTOCOL"-->
+ OILS_OPAC_STATIC_PROTOCOL = '<!--#echo var="OILS_OPAC_STATIC_PROTOCOL"-->';
+ <!--#endif -->
<!-- builds the "Now searching: <org_unit>" text on the home page -->
function home_init() {
<!--#endif-->
+<!--#if expr="$HTTPS"-->
+ <!--#set var="OILS_PROTOCOL" value="https"-->
+ <!--#if expr="$OILS_OPAC_BYPASS_STATIC_FOR_HTTPS=='yes'"-->
+ <!--#set var="OILS_OPAC_CSS_HOST" value=""-->
+ <!--#set var="OILS_OPAC_JS_HOST" value=""-->
+ <!--#endif-->
+<!--#else-->
+ <!--#set var="OILS_PROTOCOL" value="http"-->
+<!--#endif-->
+
+<!--#if expr="$OILS_OPAC_STATIC_PROTOCOL"-->
+
+<!--#else-->
+ <!--#set var="OILS_OPAC_STATIC_PROTOCOL" value="$OILS_PROTOCOL"-->
+<!--#endif-->
-<!--#set var="OILS_BASE" value="http://${SERVER_NAME}/${OILS_OPAC_BASE}"-->
+<!--#set var="OILS_BASE" value="${OILS_PROTOCOL}://${SERVER_NAME}/${OILS_OPAC_BASE}"-->
<!--#set var="OILS_XML_BASE" value="${OILS_BASE}/common/xml"-->
<!-- Javascript host -->
<!--#if expr="$OILS_OPAC_JS_HOST"-->
- <!--#set var="OILS_OPAC_JS_HOST" value="http://${OILS_OPAC_JS_HOST}"-->
+ <!--#set var="OILS_OPAC_JS_HOST" value="${OILS_OPAC_STATIC_PROTOCOL}://${OILS_OPAC_JS_HOST}"-->
<!--#else -->
<!--#set var="OILS_OPAC_JS_HOST" value="$OILS_BASE"-->
<!--#endif -->
<!--#if expr="$OILS_OPAC_CSS_HOST"-->
- <!--#set var="OILS_OPAC_CSS_HOST" value="http://${OILS_OPAC_CSS_HOST}"-->
+ <!--#set var="OILS_OPAC_CSS_HOST" value="${OILS_OPAC_STATIC_PROTOCOL}://${OILS_OPAC_CSS_HOST}"-->
<!--#else -->
<!--#set var="OILS_OPAC_CSS_HOST" value="$OILS_BASE"-->
<!--#endif -->