lemoynelibrary / lemoyne

Files used in setting up new web design in LibGuides v2 and elsewhere
5 stars 1 forks source link

Make catalog be HTTPS-only #37

Open tomkeays opened 6 years ago

tomkeays commented 6 years ago

Surprisingly, III does not yet have a HTTPS-only option for Apache. According to https://iii.rightanswers.com/portal/app/portlets/results/viewsolution.jsp?solutionid=180509111739076&page=1&position=1 (dated May 18, 2018)

Innovative's current Apache configuration does not support forcing WebPAC to use HTTPS only. Customers are welcome to include code of their own in any customizable file and/or wwwoptions to achieve redirects at the client level, but doing so is not supported. ... Innovative Product Development is working to alter our Apache configuration templates so that "HTTPS Everywhere" will soon be supported.

This script was offered up on the III Sierra listserv : https://github.com/leanwi/Sierra-Utils/blob/master/http-to-https.js

if (window.location.protocol != 'https:') {
  const stagingHTTP  = ':2082';   // Default http port for staging 
  const stagingHTTPS = ':444';    // Default https port for staging

  var newLocation;                

  newLocation = location.href.replace('http://', 'https://');     // Update location with "https" and load our var
  newLocation = newLocation.replace(stagingHTTP, stagingHTTPS);   // If in staging we'll need to expressly swap out ports
  window.location = newLocation;                                   
}