Tech Blog :: Drupal Fix: Ajax and Secure Pages


Jun 30 '10 10:07pm
Tags

Drupal Fix: Ajax and Secure Pages

Drupal's Secure Pages module is great for enforcing HTTPs/SSL on particular parts of a site. But it's known to have a problem with Ajax, especially (for my purposes) autocomplete fields in node forms. The solution is to toggle https:// in $base_url so it's not seen as cross-domain, and that's most easily done by putting this line in settings.php (changing mysite.com as needed):

$base_url = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') ? 'https://' : 'http://') . 'mysite.com';

Thanks! This was the problem I was having; this quick solution fixed it.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote>
  • Lines and paragraphs break automatically.
  • Identifies Twitpic URLs, downloads their images, displays image instead of URL.

More information about formatting options