From 0e76dc0cd8cc8434bddf360518b242741a3e1455 Mon Sep 17 00:00:00 2001 From: miker Date: Tue, 2 Jun 2009 17:11:02 +0000 Subject: [PATCH] Patch from Jeff Godin (MLC/TADL) which: 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 --- Open-ILS/examples/apache/eg_vhost.conf | 16 +++++++++++++++- Open-ILS/web/opac/common/js/added_content.js | 3 ++- .../web/opac/skin/default/xml/common/js_common.xml | 4 ++++ Open-ILS/web/opac/skin/default/xml/setenv.xml | 21 ++++++++++++++++++--- 4 files changed, 39 insertions(+), 5 deletions(-) diff --git a/Open-ILS/examples/apache/eg_vhost.conf b/Open-ILS/examples/apache/eg_vhost.conf index 13eab05e01..3111fe0c1c 100644 --- a/Open-ILS/examples/apache/eg_vhost.conf +++ b/Open-ILS/examples/apache/eg_vhost.conf @@ -75,12 +75,26 @@ RewriteRule - - [E=locale:%1] [L] 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 + diff --git a/Open-ILS/web/opac/common/js/added_content.js b/Open-ILS/web/opac/common/js/added_content.js index 850858d87b..4e2074ce8a 100644 --- a/Open-ILS/web/opac/common/js/added_content.js +++ b/Open-ILS/web/opac/common/js/added_content.js @@ -5,8 +5,9 @@ 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; } diff --git a/Open-ILS/web/opac/skin/default/xml/common/js_common.xml b/Open-ILS/web/opac/skin/default/xml/common/js_common.xml index 3bdcf30512..a3de65272b 100644 --- a/Open-ILS/web/opac/skin/default/xml/common/js_common.xml +++ b/Open-ILS/web/opac/skin/default/xml/common/js_common.xml @@ -30,6 +30,10 @@ OILS_OPAC_IMAGES_HOST = 'extras/ac/jacket/'; + var OILS_OPAC_STATIC_PROTOCOL = null; + + OILS_OPAC_STATIC_PROTOCOL = ''; + function home_init() { diff --git a/Open-ILS/web/opac/skin/default/xml/setenv.xml b/Open-ILS/web/opac/skin/default/xml/setenv.xml index d95a6ad8b3..e64b27020e 100644 --- a/Open-ILS/web/opac/skin/default/xml/setenv.xml +++ b/Open-ILS/web/opac/skin/default/xml/setenv.xml @@ -30,14 +30,29 @@ + + + + + + + + + + + + + + + - + - + @@ -45,7 +60,7 @@ - + -- 2.11.0