CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • https -- not redirecting included files
Pages: [1]

Author Topic: https -- not redirecting included files  (Read 1225 times)

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
https -- not redirecting included files
May 18, 2009, 10:47:53 am
It appears that when ssl is enabled for a site, the Civi pages requiring ssl rewrite the set of various .js and .css files included to be non-relative urls with https. So:

Code: [Select]
<script type="text/javascript" src="/administrator/components/com_civicrm/civicrm/js/Common.js"></script>
Becomes...

Code: [Select]
<script type="text/javascript" src="https://www.domain.org/administrator/components/com_civicrm/civicrm/js/Common.js"></script>
etc...

I've got a site that is not rewriting these include files, and consequently throwing a non-authenticated content error in the browser. The SSL cert is definitely working, but Civi is not recognizing it (it's not the issue with root domain + www. form). In addition to the main check mechanism in Utils/System.php, does Civi do a second check before rewriting the includes? Where can I find that?
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: https -- not redirecting included files
May 18, 2009, 01:26:27 pm

rewriting the includes (i.e. adjusting the resource path) happens here:

CRM/Core/Config.php, line 390 - 397 or so

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: https -- not redirecting included files
May 19, 2009, 12:29:08 pm
It must be happening somewhere else. I've traced through that function and it redirects to https properly, including the Joomla framework class. But the includes are still showing up as relative links, and thus not https.
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: https -- not redirecting included files
May 19, 2009, 02:37:47 pm
Here's the fix. In config.php, change 390-397 to:

Code: [Select]
        if ( $this->userFrameworkResourceURL ) {
            // we need to do this here so all blocks also load from an ssl server
if ( isset( $_SERVER['HTTPS'] ) &&
                 strtolower( $_SERVER['HTTPS'] ) != 'off' ) {
                CRM_Utils_System::mapConfigToSSL( );
            } else { //LCD modified to force https for includes files
                $rrb = parse_url( $this->userFrameworkResourceURL );
                $this->resourceBase = $rrb['path'];
}
        }

This forces https full urls (instead of relative) for all includes on https pages.
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • https -- not redirecting included files

This forum was archived on 2017-11-26.