I have recently switched one of the Drupal sites I manage to use HTTPS only and have encountered an issue with some of the AJAX requests going via HTTP.

Due to this the Views admin UI becomes largely unusable over HTTPS. I can load the form to add a filter, but when I click the button to save my option I get the error in the browser console saying the page "was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint".

I have had a look at the url() function and it won't generate a HTTPS link when an absolute URL is requested, unless explicitly told to do so.

Attached is a patch which modifies includes/ajax.inc and plugins/views_wizard/views_ui_base_views_wizard.class.php so that calls to url() have the https option enabled if the page was loaded over https. I have had a look through the other uses of url() in the codebase. At the moment I haven't included them in the scope of this fix as I didn't think it was necessary.

Thanks for reviewing this patch. After testing it seems to work now and we have already applied this to our production environment.

CommentFileSizeAuthor
https_support.patch2.19 KBakoepke

Comments

Status: Needs review » Needs work

The last submitted patch, https_support.patch, failed testing.

akoepke’s picture

Status: Needs work » Needs review

rv0 queued https_support.patch for re-testing.

Status: Needs review » Needs work

The last submitted patch, https_support.patch, failed testing.

rv0’s picture

Some weird stuff in this patch.. $is_https is supposed to be a boolean, but I see $is_https == 'on'; in the code.
I tested views on my https site with the code as is, placing a dpm($url), and I got a nice https url.

ccamporeale’s picture

I ran into this as well, running an https only site. Installing securepages resolved the problem for me.

rv0’s picture

Perhaps you can get around those issues using seckit.module, or by just rewriting any http path to https with htaccess?
I don't seem to have the issue on a full https site.